OSGi configuration

To implement Metadata-Driven Permissions a developer must deploy an OSGi configuration to AEM as a Cloud Service, that enables specific asset content or metadata properties to power metadata-driven permissions.

  1. Determine which asset content or metadata properties will be used for access control. The property names are the JCR property names on the asset’s jcr:content or jcr:content/metadata resource. In our case it going to be a property called status.

  2. Create an OSGi configuration com.adobe.cq.dam.assetmetadatarestrictionprovider.impl.DefaultRestrictionProviderConfiguration.cfg.json in your AEM Maven project.

  3. Paste the following JSON into the created file:

    {
      "restrictionPropertyNames":[
        "status",
        "brand"
      ],
      "restrictionContentPropertyNames":[],
      "enabled":true
    }
    
  4. Replace the property names with the required values. The restrictionContentPropertyNames configuration property is used to enable permissions on jcr:content resource properties, while the restrictionPropertyNames configuration property enables permissions on jcr:content/metadata resource properties for assets.

Reset base asset permissions

Before adding restriction-based Access Control Entries, a new top-level entry should be added to first deny read access to all groups that are subject to permission evaluation for Assets (e.g. “contributors” or similar):

  1. Navigate to the Tools → Security → Permissions screen
  2. Select the Contributors group (or other custom group that all users groups belong to)
  3. Click Add ACE in the upper right corner of the screen
  4. Select /content/dam for Path
  5. Enter jcr:read for Privileges
  6. Select Deny for Permission Type
  7. Under Restrictions, select rep:ntNames and enter dam:Asset as the Restriction Value
  8. Click Save

Deny Access