final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
final String mailboxName = message.getMailboxName();
final String identifier = message.getIdentifier();
try {
MessageManager messageManager = mailboxManager.getMailbox(buildFullPath(session, mailboxName), 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.
*/
if (!messageManager.hasRight(Rfc4314Rights.l_Lookup_RIGHT, mailboxSession)) {
no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
}
/* RFC 4314 section 4. */
else if (!messageManager.hasRight(Rfc4314Rights.a_Administer_RIGHT, mailboxSession)) {
Object[] params = new Object[] {
Rfc4314Rights.a_Administer_RIGHT.toString(),
command.getName(),
mailboxName
};
HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
no(command, tag, responder, text);
}
else {
MailboxACLEntryKey key = new SimpleMailboxACLEntryKey(identifier);
// FIXME check if identifier is a valid user or group
// FIXME Servers, when processing a command that has an identifier as a
// parameter (i.e., any of SETACL, DELETEACL, and LISTRIGHTS commands),
// SHOULD first prepare the received identifier using "SASLprep" profile
// [SASLprep] of the "stringprep" algorithm [Stringprep]. If the
// preparation of the identifier fails or results in an empty string,
// the server MUST refuse to perform the command with a BAD response.
// Note that Section 6 recommends additional identifier’s verification
// steps.
MailboxACLRights[] rights = messageManager.listRigths(key, mailboxSession);
ListRightsResponse aclResponse = new ListRightsResponse(mailboxName, identifier, rights);
responder.respond(aclResponse);
okComplete(command, tag, responder);
// FIXME should we send unsolicited responses here?
// unsolicitedResponses(session, responder, false);