jackrabbitjackrabbit-oak

Access control to the new user


  1. Create User

We could create user successfully by using userManager.createUser

  1. User Access privilege to absPath

created newSession with newly created user.

String[] privileges = new String[]{PrivilegeConstants.JCR_ALL};
AccessControlUtils.addAccessControlEntry(newSession, absPath, new PrincipalImpl(user.getUsername()),
                        privileges, true);

Caused by: javax.jcr.PathNotFoundException: No tree at /advitium/repo at org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.AbstractAccessControlManager.getTree(AbstractAccessControlManager.java:164) at org.apache.jackrabbit.oak.security.authorization.accesscontrol.AccessControlManagerImpl.getApplicablePolicies(AccessControlManagerImpl.java:195)

whereas the same path can be accessed using admin session.

Question : How do we provide access to the node for the new user.


Solution

  • We have to use admin session to assign prviliges with the newly created principal.