예제 #1
0
  /** @see AccessManager#close() */
  public void close() throws Exception {
    if (!initialized) {
      throw new IllegalStateException("Manager is not initialized.");
    }
    initialized = false;
    compiledPermissions.close();

    hierMgr = null;
    acProvider = null;
    editor = null;
    wspAccess = null;
  }
예제 #2
0
 /**
  * @see org.apache.jackrabbit.core.security.authorization.AccessControlProvider#canAccessRoot(Set)
  */
 public boolean canAccessRoot(Set<Principal> principals) throws RepositoryException {
   checkInitialized();
   if (isAdminOrSystem(principals)) {
     return true;
   } else {
     CompiledPermissions cp =
         new CompiledPermissionsImpl(principals, session, entryCollector, this, false);
     try {
       return cp.canRead(null, rootNodeId);
     } finally {
       cp.close();
     }
   }
 }
예제 #3
0
  /**
   * @see org.apache.jackrabbit.api.security.JackrabbitAccessControlManager#getPrivileges(String,
   *     Set)
   */
  public Privilege[] getPrivileges(String absPath, Set<Principal> principals)
      throws PathNotFoundException, RepositoryException {
    checkInitialized();
    checkValidNodePath(absPath);
    checkPermission(absPath, Permission.READ_AC);

    CompiledPermissions perms = acProvider.compilePermissions(principals);
    try {
      Set<Privilege> privs = perms.getPrivilegeSet(getPath(absPath));
      return privs.toArray(new Privilege[privs.size()]);
    } finally {
      perms.close();
    }
  }
  /**
   * Overridden to:
   *
   * <ul>
   *   <li>Use custom {@code CompiledPermissions}.
   * </ul>
   *
   * @see PentahoCompiledPermissionsImpl
   */
  @Override
  public boolean canAccessRoot(Set<Principal> principals) throws RepositoryException {
    checkInitialized();
    if (isAdminOrSystem(principals)) {

      return true;
    } else {
      CompiledPermissions cp = getCompiledPermissions(principals);
      try {
        return cp.canRead(null, getRootNodeId());
      } finally {
        cp.close();
      }
    }
  }
예제 #5
0
  /**
   * @see org.apache.jackrabbit.api.security.JackrabbitAccessControlManager#hasPrivileges(String,
   *     Set, Privilege[])
   */
  public boolean hasPrivileges(String absPath, Set<Principal> principals, Privilege[] privileges)
      throws PathNotFoundException, RepositoryException {
    checkInitialized();
    checkValidNodePath(absPath);
    checkPermission(absPath, Permission.READ_AC);

    if (privileges == null || privileges.length == 0) {
      // null or empty privilege array -> return true
      log.debug("No privileges passed -> allowed.");
      return true;
    } else {
      Path p = getPath(absPath);
      CompiledPermissions perms = acProvider.compilePermissions(principals);
      try {
        return perms.hasPrivileges(p, privileges);
      } finally {
        perms.close();
      }
    }
  }