示例#1
0
 private void update(AccessControlManager acm, JcrAccessControlList a1, AccessControlList a2)
     throws AccessControlException, RepositoryException {
   Collection<JcrPolicy> policies = a1.entries();
   for (JcrPolicy policy : policies) {
     a2.addAccessControlEntry(
         new SimplePrincipal(policy.getPrincipal()), privileges(acm, policy.getPermissions()));
   }
 }
示例#2
0
  private JcrAccessControlList getAccessList(AccessControlManager acm, Node node)
      throws RepositoryException {
    AccessControlList accessList = findAccessList(acm, node);
    if (accessList == null) {
      return JcrAccessControlList.defaultInstance();
    }

    JcrAccessControlList acl = new JcrAccessControlList();

    AccessControlEntry[] entries = accessList.getAccessControlEntries();
    for (AccessControlEntry entry : entries) {
      JcrPolicy en = new JcrPolicy();
      en.setPrincipal(entry.getPrincipal().getName());
      Privilege[] privileges = entry.getPrivileges();
      for (Privilege p : privileges) {
        en.add(new JcrPermission(p.getName()));
      }
    }
    return acl;
  }