Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Failed to add ACL permissions in AEM 6.3

Avatar

Avatar
Validate 10
Level 3
sreenivasula
Level 3

Likes

7 likes

Total Posts

95 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
sreenivasula
Level 3

Likes

7 likes

Total Posts

95 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
sreenivasula
Level 3

08-08-2018

Hello All,

            We are creating certain users and assigning ACL permissions programmatically, using below code(partial  code), which is perfectly working in AEM 6.0 but failing in AEM 6.3, throwing below exception.

Coul you please let us know, how to implement the below in AEM 6.3, any helpx document will be helpful.

06.08.2018 13:41:49.267 *ERROR* [qtp1995913297-46126] com.abc.xyz.cms.author-config-2.0.0.SNAPSHOT [com.abc.xyz.cms.bundle.config.AuthorConfigInitializer(3275)] The start method has thrown an exception (java.lang.ClassCastException: org.apache.jackrabbit.oak.spi.security.authorization.cug.impl.CugPolicyImpl cannot be cast to javax.jcr.security.AccessControlList)

java.lang.ClassCastException: org.apache.jackrabbit.oak.spi.security.authorization.cug.impl.CugPolicyImpl cannot be cast to javax.jcr.security.AccessControlList

        at com.abc.xyz.cms.service.persistence.user.impl.AddACLPermiOperation.addACLPermiForGroup(AddACLPermiOperation.java:74)

Partial Code:-

@PerformInSession

public void addACLPermiForGroup(final String groupName, final String path, final String privilege)

        throws UserPersistenceException {

    try {

        UserManagerWrapper userManagerWrapper = userManagerWrapperFactory.createUserManagerWrapper();

        AccessControlManager aMgr = accessControlManagerFactory.createAccessControlManager();

        AccessControlList acl;

        for (String strPath : path.split(PATH_CONFIG_SEPARATOR)) {

            AccessControlPolicyIterator acplItr = aMgr.getApplicablePolicies(strPath);

            if (acplItr.hasNext()) {

                // get first applicable policy (for nodes w/o policy)

               acl = (AccessControlList) acplItr.nextAccessControlPolicy(); // Exception is thrown at this line

            } else {

                // else node already has a policy, get that one

                acl = (AccessControlList) aMgr.getPolicies(strPath)[0];

            }

            for (AccessControlEntry e : acl.getAccessControlEntries()) {

                Principal p = e.getPrincipal();

                if (e.getPrincipal().equals(userManagerWrapper.getExistingAemGroup(groupName).getPrincipal()))

                {

                    acl.removeAccessControlEntry(e);

                }

            }

           String[] privilegeNames = privilege.split(PATH_CONFIG_SEPARATOR);

            Privilege[] privileges = new Privilege[privilegeNames.length];

            for(int i=0; i < privileges.length; i++)

            {

                privileges[i] = aMgr.privilegeFromName(privilegeNames[i]);

            }

            acl.addAccessControlEntry(

                    userManagerWrapper.getExistingAemGroup(groupName).getPrincipal(), privileges);

            aMgr.setPolicy(strPath, acl);

        }

    } catch (RepositoryException e) {

        throw new RetryableRepositoryException(String.format(

                "Failed to add %s ACL permission to %s for %s", privilege, path, groupName, e));

    }

}

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 7
Jitendra_S_Toma
Level 7

Likes

71 likes

Total Posts

615 posts

Correct Reply

84 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 7
Jitendra_S_Toma
Level 7

Likes

71 likes

Total Posts

615 posts

Correct Reply

84 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
Jitendra_S_Toma
Level 7

08-08-2018

Hi Sree,

Here is very good documentation around it. I believe it is just API Change and not anything logically failing there. Just follow the sections for reading/updating access policy.

Closed User Groups in AEM 6.3

Answers (3)

Answers (3)

Avatar

Avatar
Boost 1
Level 1
muruganr007
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
muruganr007
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
muruganr007
Level 1

26-09-2018

Hi Sreenivasalu,

We are also facing the same issue,

org.apache.jackrabbit.oak.spi.security.authorization.cug.impl.CugPolicyImpl cannot be cast to javax.jcr.security.AccessControlList.

I tried to modify the code from the suggested link but still i am facing the same issue.Closed User Groups in AEM 6.3

Please let us know what you have done to fix this issue.

Avatar

Avatar
Level 1
velparic1097644
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
velparic1097644
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile
velparic1097644
Level 1

26-09-2018

Hi Sreenivasula,

                            This is Velpari. We are also facing the same issue for the permission. Did the permission issue fixed for you ?

In-case if it fixed, Can you please send us the updated code or suggest how to fix the Issue ??

Avatar

Avatar
Level 1
velparic1097644
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
velparic1097644
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile
velparic1097644
Level 1

25-09-2018

Hi Jitendra,

                    We had checked this link  Closed User Groups in AEM 6.3  in which they are assigning some values to the Principal Api . Please find the below code

"

Principal toAdd1 = [...]

Principal toAdd2 = [...]

"

Can you please suggest us what parameters we need to pass to the variables toAdd1,toAdd2. ??