valtech / aem-advanced-permissions-manager

AEM Advanced Permission Manager
MIT License
1 stars 1 forks source link

AEM Advanced Permissions Manager

AEM Advanced Permissions Manager uses custom Oak restriction mechanism to provide a way to apply the permission. The permission is applied only if the defined condition is met. Currently the main example is to allow/deny access if an asset owns (or does not own) a tag.

This mechanism can be used to restrict a standard ACL permission for any asset.

Requirements

AAPM requires Java 11, Maven >= 3.6.0 and AEM Cloud/6.5.

AEM Version AAPM
Cloud 0.9.x
6.5 0.9.x

Deploying

There are 2 ways to deploy:

Deploy as Maven dependency:

<dependency>
    <groupId>com.valtech.aapm</groupId>
    <artifactId>aapm.all</artifactId>
    <version>LATEST</version>
    <type>zip</type>
</dependency>

Uninstallation

Removing following paths

Deleting users and groups (in /security/users.html)

Users

Delete following groups

Define restriction

User with the appropriate rights, can define restrictions.

Build a rep:hasPropertyValues restriction

A restriction is written like this:

where:

Examples

You can install the aapm.examples package for the following examples. Be careful: the permission type (allow or deny) has to be the same than the "restriction type". See examples below.

Example 1
Example 2
Example 3

Restriction through permission tab

1 - Go to permission tab (Tools/Security/Permission) ![from permission tab, user can modify or add new restriction](illustrations/aapm-Permission tab.png "Permission tab") 2- Click "Add ACE" and follow instructions user can add new restriction through this tab

Restriction through repoinit file

config file location: apps/aapm-examples/osgiconfig/config/org.apache.sling.jcr.repoinit.RepositoryInitializer-aapm.config

# Test 1: with user that has permission to see the all inside test-allow folder
- aapm-default-reader:
- path: /content/dam/aapm-test/test-allow
  permission: allow
  actions:
  privileges: jcr:all
  restrictions:
    hasPropertyValues: allow#string$cq:tags==properties:orientation/portrait

# Test 2: with user that has NO permission on test-deny but with permission in test-deny/subfolder
- path: /content/dam/aapm-test/test-deny
  permission: deny
  actions:
  privileges: jcr:all
  restrictions:
    hasPropertyValues: deny#string$cq:tags==properties:orientation/portrait

- path: /content/dam/aapm-test/test-deny/subfolder
  permission: allow
  actions:
  privileges: jcr:all
  restrictions:
    hasPropertyValues: allow#string$cq:tags==properties:orientation/portrait

Modify Restriction

User can modify existing restriction even through yaml or permission tab.

Result according to yaml file definition

# Test 1
1 - Login as admin user
2 - Navigate to /content/dam/aapm-test/test-allow folder
4 - User should see all assets and sub folder
3 - Unpersonnate as atest-aapm-reader (/apps/valtech/aapm-examples/aapm/permissions/users/aapm-ace-user.yaml)
4 - Result: user will only see all assets with the tag properties:orientation/portrait

Login with admin user account, user see all content on /test-allow folder, we apply restriction to apply allow permission only if asset has tag protrait

# Test 2
1 - Login as admin user
2 - Navigate to /content/dam/aapm-test/test-deny
3 - User should see all assets and sub folder
4 - Unpersonnate as atest-aapm-restricted (/apps/valtech/aapm-examples/aapm/permissions/users/aapm-ace-user.yaml)
5 - Result: user should see only assets without the tag properties:orientation/portrait in "test-deny" and all asssets in "/subfolder" (because for the group "aapm-restricted" deny access for assets with tag "properties:orientation/portrait" has been overidden by an allow access for "subfolder")

admin user see all content admin user see all content admin user see all content

Build a rep:subFolder restriction

A restriction is written like this:

where:

Examples

Example 1

All items under /content/dam/test/**/**/ will have rep:write access.

Developers

See our developer zone.