public Privilege[] getPrivileges(String s) throws RepositoryException {

    Item item = registrySession.getItem(s);
    if (item instanceof Property) {
      throw new PathNotFoundException("No privilages can be added for Properties");
    }

    Set<Privilege> privileges = new HashSet<Privilege>();

    if (accessCtrlPolicies.get(s) instanceof RegistryAccessControlList) {

      AccessControlEntry[] accessNtries =
          ((RegistryAccessControlList) accessCtrlPolicies.get(s)).getAccessControlEntries();

      for (AccessControlEntry ac : accessNtries) {
        if (ac != null) {
          privileges.addAll(Arrays.asList(ac.getPrivileges()));
        }
      }
    } else {
      // TODO check how to apply NamedAccessControlPolicy
    }

    // Read-only session must have READ privilege on test node
    if (RegistryJCRSpecificStandardLoderUtil.isSessionReadOnly(registrySession.getUserID())
        && !privileges.contains(privilegeRegistry.getPrivilegeFromName(Privilege.JCR_READ))) {
      privileges.add(privilegeRegistry.getPrivilegeFromName(Privilege.JCR_READ));
    }

    if (privileges.size() != 0) {
      return privileges.toArray(new Privilege[privileges.size()]);
    } else return new Privilege[0];
  }
 public Privilege privilegeFromName(String s) throws RepositoryException {
   return privilegeRegistry.getPrivilegeFromName(s);
 }
 public Privilege[] getSupportedPrivileges(String s) throws RepositoryException {
   //        This method does not return the privileges held by the session. Instead, it returns
   // the privileges that the repository supports.
   //       TODO   checkValidNodePath(absPath);
   return privilegeRegistry.getRegisteredPrivileges();
 }