You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by er...@apache.org on 2012/02/08 11:55:10 UTC
svn commit: r1241861 -
/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
Author: eric
Date: Wed Feb 8 10:55:10 2012
New Revision: 1241861
URL: http://svn.apache.org/viewvc?rev=1241861&view=rev
Log:
Find out if a mailbox owner is a group through the namespace of the mailbox, contributed by Jochen Gazda (MAILBOX-158)
Modified:
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
Modified: james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java?rev=1241861&r1=1241860&r2=1241861&view=diff
==============================================================================
--- james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java (original)
+++ james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java Wed Feb 8 10:55:10 2012
@@ -449,9 +449,7 @@ public class StoreMessageManager<Id> imp
recent = new ArrayList<Long>();
break;
}
- // FIXME
- boolean resourceOwnerIsGroup = false;
- MailboxACL resolvedAcl = aclResolver.applyGlobalACL(mailbox.getACL(), resourceOwnerIsGroup );
+ MailboxACL resolvedAcl = aclResolver.applyGlobalACL(mailbox.getACL(), isGroupFolder(mailboxSession) );
return new MailboxMetaData(recent, permanentFlags, uidValidity, uidNext,highestModSeq, messageCount, unseenCount, firstUnseen, isWriteable(mailboxSession), isModSeqPermanent(mailboxSession), resolvedAcl );
}
@@ -697,10 +695,21 @@ public class StoreMessageManager<Id> imp
User user = session.getUser();
String userName = user != null ? user.getUserName() : null;
- // FIXME probably mailbox should provide the information whether the resource owner is group; otherwise user names and group names may clash
- boolean resourceOwnerIsGroup = false;
-
- return aclResolver.hasRight(userName, groupMembershipResolver, right, mailbox.getACL(), mailbox.getUser(), resourceOwnerIsGroup);
+ return aclResolver.hasRight(userName, groupMembershipResolver, right, mailbox.getACL(), mailbox.getUser(), isGroupFolder(session));
+ }
+
+ /**
+ * Returns true if the current mailbox does not reside neither in private nor other users' namespace.
+ *
+ * @param session
+ * @return
+ */
+ protected boolean isGroupFolder(MailboxSession session) {
+ final String ns = mailbox.getNamespace();
+ return ns == null || (
+ !ns.equals(session.getPersonalSpace())
+ && !ns.equals(session.getOtherUsersSpace())
+ );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org