Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

AEM 6.5.10 - Assets Metadata Based Custom Restriction Provider | AEM Community Blog Seeding




AEM 6.5.10 - Assets Metadata Based Custom Restriction Provider by Sreekanth Choudry Nalabotu


In Assets, for dam-users group do NOT show jpg assets with metadata assetCategory is RESTRICTED, always show when assetCategory is ALLOWED and when assetCategory is missing/empty you may or may not want to show such assets( depending on admin having good day or bad day...) here is some authorization documentation

1) Add the assetCategory restriction apps.experienceaem.assets.core.acls.EAEMAssetCategoryRestriction

package apps.experienceaem.assets.core.acls;

import com.adobe.xfa.ut.StringUtils;
import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionPattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EAEMAssetCategoryRestriction implements RestrictionPattern {
private static final Logger log = LoggerFactory.getLogger(EAEMAssetCategoryRestriction.class);

private final String restrictedValue;
public static final String ASSET_CATEGORY = "assetCategory";

EAEMAssetCategoryRestriction(String restrictedValue) {
this.restrictedValue = restrictedValue;

public boolean matches(Tree tree, PropertyState propertyState) {
PropertyState property = tree.getChild(JcrConstants.JCR_CONTENT).getChild("metadata").getProperty(ASSET_CATEGORY);

if(property == null){
return true;
return false;

String value = property.getValue(Type.STRING);

if(restrictedValue.equals("EMPTY") && StringUtils.isEmpty(value)){
return true;

return restrictedValue.equalsIgnoreCase(value);

public boolean matches(String path) {
return false;

public boolean matches() {
return false;

Read Full Blog

AEM 6.5.10 - Assets Metadata Based Custom Restriction Provider


Please use this thread to ask the related questions.

Kautuk Sahni
0 Replies