예제 #1
0
  /** @see AccessManager#isGranted(ItemId, int) */
  public boolean isGranted(ItemId id, int actions)
      throws ItemNotFoundException, RepositoryException {
    checkInitialized();
    if (actions == READ && compiledPermissions.canReadAll()) {
      return true;
    } else {
      int perm = 0;
      if ((actions & READ) == READ) {
        perm |= Permission.READ;
      }
      if ((actions & WRITE) == WRITE) {
        if (id.denotesNode()) {
          // TODO: check again if correct
          perm |= Permission.SET_PROPERTY;
          perm |= Permission.ADD_NODE;
        } else {
          perm |= Permission.SET_PROPERTY;
        }
      }
      if ((actions & REMOVE) == REMOVE) {
        perm |= (id.denotesNode()) ? Permission.REMOVE_NODE : Permission.REMOVE_PROPERTY;
      }

      Path path = hierMgr.getPath(id);
      return isGranted(path, perm);
    }
  }
예제 #2
0
 /**
  * @see AccessManager#canRead(org.apache.jackrabbit.spi.Path,org.apache.jackrabbit.core.id.ItemId)
  */
 public boolean canRead(Path itemPath, ItemId itemId) throws RepositoryException {
   checkInitialized();
   if (compiledPermissions.canReadAll()) {
     return true;
   } else {
     return compiledPermissions.canRead(itemPath, itemId);
   }
 }