final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
final String mailboxName = message.getMailboxName();
try {
MessageManager messageManager = mailboxManager.getMailbox(buildFullPath(session, mailboxName), mailboxSession);
MailboxACLRights myRights = messageManager.myRights(mailboxSession);
/*
* RFC 4314 section 6. An implementation MUST make sure the ACL
* commands themselves do not give information about mailboxes with
* appropriately restricted ACLs. For example, when a user agent
* executes a GETACL command on a mailbox that the user has no
* permission to LIST, the server would respond to that request with
* the same error that would be used if the mailbox did not exist,
* thus revealing no existence information, much less the mailbox’s
* ACL.
*
* RFC 4314 section 4. * MYRIGHTS - any of the following rights is
* required to perform the operation: "l", "r", "i", "k", "x", "a".
*/
if (!myRights.contains(Rfc4314Rights.l_Lookup_RIGHT)
&& !myRights.contains(Rfc4314Rights.r_Read_RIGHT)
&& !myRights.contains(Rfc4314Rights.i_Insert_RIGHT)
&& !myRights.contains(Rfc4314Rights.k_CreateMailbox_RIGHT)
&& !myRights.contains(Rfc4314Rights.x_DeleteMailbox_RIGHT)
&& !myRights.contains(Rfc4314Rights.a_Administer_RIGHT)) {
no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
} else {
MyRightsResponse myRightsResponse = new MyRightsResponse(mailboxName, myRights);
responder.respond(myRightsResponse);
okComplete(command, tag, responder);