예제 #1
0
  public boolean canRead(String userId) {
    if (globalRead) {
      return true;
    }
    if (ownerId.equals(userId)) {
      return true;
    }
    for (GrantInfo grantInfo : grants) {
      if (grantInfo.getGrantGroup() != null) {
        String groupUri = grantInfo.getGrantGroup();
        if (groupUri.equals(WalrusProperties.AUTHENTICATED_USERS_GROUP)) return true;
      }
    }

    for (GrantInfo grantInfo : grants) {
      if (grantInfo.getUserId().equals(userId)) {
        if (grantInfo.canRead()) {
          return true;
        }
      }
    }

    if (UserManagement.isAdministrator(userId)) {
      return true;
    }

    return false;
  }
예제 #2
0
 public boolean canReadACP(String userId) {
   if (ownerId.equals(userId)) {
     // owner can always acp
     return true;
   } else if (globalReadACP) {
     return true;
   } else {
     for (GrantInfo grantInfo : grants) {
       if (grantInfo.getUserId().equals(userId) && grantInfo.canReadACP()) {
         return true;
       }
     }
   }
   if (UserManagement.isAdministrator(userId)) {
     return true;
   }
   return false;
 }
예제 #3
0
  public boolean canWriteACP(String userId) {
    if (globalWriteACP) {
      return true;
    }
    if (ownerId.equals(userId)) {
      return true;
    }
    for (GrantInfo grantInfo : grants) {
      if (grantInfo.getUserId().equals(userId)) {
        if (grantInfo.isWriteACP()) {
          return true;
        }
      }
    }
    if (UserManagement.isAdministrator(userId)) {
      return true;
    }

    return false;
  }