Java Code Examples for org.apache.jackrabbit.api.security.user.Authorizable#getPrincipal()
The following examples show how to use
org.apache.jackrabbit.api.security.user.Authorizable#getPrincipal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JackrabbitACLImporter.java From jackrabbit-filevault with Apache License 2.0 | 6 votes |
private ImportedPrincipalAcList(DocViewNode node) { String principalName = node.getValue("rep:principalName"); Principal p = pMgr.getPrincipal(principalName); if (p == null) { try { Authorizable a = session.getUserManager().getAuthorizableByPath(accessControlledPath); if (a != null) { p = a.getPrincipal(); } } catch (RepositoryException e) { log.debug("Error while trying to retrieve user/group from access controlled path {}, {}", accessControlledPath, e.getMessage()); } if (p == null) { p = getPrincipal(principalName); } } principal = p; }
Example 2
Source File: CheckPermissions.java From APM with Apache License 2.0 | 5 votes |
private Set<Principal> getAuthorizablesToCheck(Authorizable authorizable, Context context) throws RepositoryException { Set<Principal> principals = new HashSet<>(); Principal principal = authorizable.getPrincipal(); principals.add(principal); for (PrincipalIterator it = (context.getSession()).getPrincipalManager() .getGroupMembership(principal); it.hasNext(); ) { principals.add(it.nextPrincipal()); } return principals; }
Example 3
Source File: RemoveAll.java From APM with Apache License 2.0 | 5 votes |
private void removeAll(final Context context, Authorizable authorizable) throws RepositoryException { final AccessControlManager accessControlManager = context.getAccessControlManager(); final Principal principal = authorizable.getPrincipal(); final JackrabbitAccessControlList jackrabbitAcl = JackrabbitAccessControlListUtil .getModifiableAcl(accessControlManager, path); final AccessControlEntry[] accessControlEntries = jackrabbitAcl.getAccessControlEntries(); for (final AccessControlEntry accessControlEntry : accessControlEntries) { if (accessControlEntry.getPrincipal().equals(principal)) { jackrabbitAcl.removeAccessControlEntry(accessControlEntry); } } accessControlManager.setPolicy(path, jackrabbitAcl); }