/** * Check if the specified policy can be set/removed from this editor. * * @param nodePath the node path * @param policy the policy * @throws AccessControlException if not allowed */ private static void checkValidPolicy(String nodePath, AccessControlPolicy policy) throws AccessControlException { if (policy == null || !(policy instanceof ACLTemplate)) { throw new AccessControlException("Attempt to set/remove invalid policy " + policy); } ACLTemplate acl = (ACLTemplate) policy; boolean matchingPath = (nodePath == null) ? acl.getPath() == null : nodePath.equals(acl.getPath()); if (!matchingPath) { throw new AccessControlException("Policy " + policy + " cannot be applied/removed from the node at " + nodePath); } }
/** * Check if the specified policy can be set/removed from this editor. * * @param nodePath the node path * @param policy the policy * @throws AccessControlException if not allowed */ private static void checkValidPolicy(String nodePath, AccessControlPolicy policy) throws AccessControlException { if (policy == null || !(policy instanceof ACLTemplate)) { throw new AccessControlException("Attempt to set/remove invalid policy " + policy); } ACLTemplate acl = (ACLTemplate) policy; boolean matchingPath = (nodePath == null) ? acl.getPath() == null : nodePath.equals(acl.getPath()); if (!matchingPath) { throw new AccessControlException("Policy " + policy + " cannot be applied/removed from the node at " + nodePath); } }
/** * @see javax.jcr.security.AccessControlList#removeAccessControlEntry(AccessControlEntry) */ public synchronized void removeAccessControlEntry(AccessControlEntry ace) throws AccessControlException, RepositoryException { if (!(ace instanceof Entry)) { throw new AccessControlException("Invalid AccessControlEntry implementation " + ace.getClass().getName() + "."); } if (entries.contains(ace)) { entries.remove(ace); } else { throw new AccessControlException("AccessControlEntry " + ace + " cannot be removed from ACL defined at " + getPath()); } }
/** * @see javax.jcr.security.AccessControlList#removeAccessControlEntry(AccessControlEntry) */ public synchronized void removeAccessControlEntry(AccessControlEntry ace) throws AccessControlException, RepositoryException { if (!(ace instanceof Entry)) { throw new AccessControlException("Invalid AccessControlEntry implementation " + ace.getClass().getName() + "."); } if (entries.contains(ace)) { entries.remove(ace); } else { throw new AccessControlException("AccessControlEntry " + ace + " cannot be removed from ACL defined at " + getPath()); } }
private List<PentahoEntry> buildPentahoEntries( ACLTemplate acl ) throws RepositoryException { List<PentahoEntry> aces = new ArrayList<PentahoEntry>(); if ( acl != null && acl.getEntries() != null && acl.getEntries().size() > 0 ) { NodeImpl aclNode = ( (NodeImpl) systemSession.getNode( acl.getPath() ) ); for ( AccessControlEntry ace : acl.getEntries() ) { aces.add( buildPentahoEntry( aclNode.getNodeId(), acl.getPath(), ace ) ); } } return aces; }
private ACLTemplate modifyPrivileges(String path, Principal principal, Privilege[] privileges, boolean isAllow) throws NotExecutableException, RepositoryException { ACLTemplate tmpl = getPolicy(acMgr, path, principal); tmpl.addEntry(principal, privileges, isAllow); acMgr.setPolicy(tmpl.getPath(), tmpl); superuser.save(); return tmpl; }
NodeImpl ancestorNode = (NodeImpl) systemSession.getNode( ancestorAcl.getPath() ); PentahoEntries fullEntriesIncludingMagicACEs = this.getEntries( ancestorNode ); PentahoEntry pe = buildPentahoEntry( ancestorNode.getNodeId(), ancestorAcl.getPath(), ace ); if ( entry.equals( pe ) ) { ancestorAcl.removeAccessControlEntry( ace );