* org.apache.james.mailbox.MailboxACL.MailboxACLRight,
* org.apache.james.mailbox.MailboxACL, java.lang.String)
*/
@Override
public boolean hasRight(String requestUser, GroupMembershipResolver groupMembershipResolver, MailboxACLRight right, MailboxACL resourceACL, String resourceOwner, boolean resourceOwnerIsGroup) throws UnsupportedRightException {
final MailboxACLEntryKey queryKey = requestUser == null ? null : new SimpleMailboxACLEntryKey(requestUser, NameType.user, false);
boolean result = false;
Map<MailboxACLEntryKey, MailboxACLRights> entries = resourceOwnerIsGroup ? groupGlobalACL.getEntries() : userGlobalACL.getEntries();
if (entries != null) {
for (Iterator<Map.Entry<MailboxACLEntryKey, MailboxACLRights>> it = entries.entrySet().iterator(); it.hasNext();) {
final Entry<MailboxACLEntryKey, MailboxACLRights> entry = it.next();
final MailboxACLEntryKey key = entry.getKey();
if (applies(key, queryKey, groupMembershipResolver, resourceOwner, resourceOwnerIsGroup) && entry.getValue().contains(right)) {
if (key.isNegative()) {
return false;
} else {
result = true;
}
}
}
}
if (resourceACL != null) {
entries = resourceACL.getEntries();
if (entries != null) {
for (Iterator<Map.Entry<MailboxACLEntryKey, MailboxACLRights>> it = entries.entrySet().iterator(); it.hasNext();) {
final Entry<MailboxACLEntryKey, MailboxACLRights> entry = it.next();
final MailboxACLEntryKey key = entry.getKey();
if (applies(key, queryKey, groupMembershipResolver, resourceOwner, resourceOwnerIsGroup) && entry.getValue().contains(right)) {
if (key.isNegative()) {
return false;
} else {
result = true;
}
}