private Privilege[] getPrivilegesLegacy(String absPath)
      throws PathNotFoundException, RepositoryException {
    List<Privilege> l = new ArrayList<Privilege>();
    for (String s : getPrivilegesNamesLegacy(absPath)) {
      Privilege privilege = registry.getPrivilege(s, null);
      if (privilege != null) {
        l.add(privilege);
      }
    }

    return l.toArray(new Privilege[l.size()]);
  }
Exemplo n.º 2
0
 public String[] getLockTokens() {
   List<String> allTokens = new ArrayList<String>(tokens);
   for (Session session : sessions.values()) {
     String[] tokens = session.getLockTokens();
     for (String token : tokens) {
       if (!allTokens.contains(token)) {
         allTokens.add(token);
       }
     }
   }
   return allTokens.toArray(new String[allTokens.size()]);
 }
  @Override
  public Privilege[] getPrivileges(final String absPath)
      throws PathNotFoundException, RepositoryException {

    JCRNodeWrapper node =
        JCRSessionFactory.getInstance()
            .getCurrentSystemSession(workspaceName, null, null)
            .getNode(session.getRepository().getStoreProvider().getMountPoint() + absPath);
    Privilege[] privileges;
    if (supportPrivileges) {
      privileges = getPrivilegesLegacy(absPath);
    } else {
      privileges = AccessManagerUtils.getPrivileges(node, jahiaPrincipal, registry);
    }
    // filter some privileges in some specific cases, for avoid some operation from edit engines
    List<Privilege> privilegeToFilter = getPrivilegesToFilter(node.getRealNode());
    if (privilegeToFilter.size() > 0) {
      return filterPrivileges(privileges, privilegeToFilter);
    } else {
      return privileges;
    }
  }