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; }
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; }
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; }