@Override public void replaceRights(MailboxPath mailboxPath, String targetUser, Rfc4314Rights rights) throws MailboxException { MailboxSession mailboxSession = mailboxManager.createSystemSession(mailboxPath.getUser()); ACLCommand command = MailboxACL.command().forUser(targetUser).rights(rights).asReplacement(); mailboxManager.applyRightsCommand(mailboxPath, command, mailboxSession); }
@Override public void addRights(MailboxPath mailboxPath, String targetUser, Rfc4314Rights rights) throws MailboxException { MailboxSession mailboxSession = mailboxManager.createSystemSession(mailboxPath.getUser()); ACLCommand command = MailboxACL.command().forUser(targetUser).rights(rights).asAddition(); mailboxManager.applyRightsCommand(mailboxPath, command, mailboxSession); }
@Test public void testDelete() throws MailboxException { MailboxACL acl = MailboxACL.OWNER_FULL_ACL; when(mailboxManager.hasRight(path, MailboxACL.Right.Lookup, mailboxSession)) .thenReturn(true); when(mailboxManager.hasRight(path, MailboxACL.Right.Administer, mailboxSession)) .thenReturn(true); when(metaData.getACL()).thenReturn(acl); subject.doProcess(deleteACLRequest, responder, imapSession); verify(mailboxManager).applyRightsCommand(path, MailboxACL.command().key(user1Key).noRights().asReplacement(), mailboxSession); verify(responder, times(1)).respond(argumentCaptor.capture()); verifyNoMoreInteractions(responder); assertThat(argumentCaptor.getAllValues()) .hasSize(1); assertThat(argumentCaptor.getAllValues().get(0)) .matches(StatusResponseTypeMatcher.OK_RESPONSE_MATCHER::matches); }
private void testOp(String prefix, EditMode editMode) throws MailboxException { when(mailboxManager.hasRight(path, MailboxACL.Right.Lookup, mailboxSession)) .thenReturn(true); when(mailboxManager.hasRight(path, MailboxACL.Right.Administer, mailboxSession)) .thenReturn(true); SetACLRequest r = new SetACLRequest("TAG", ImapCommand.anyStateCommand("Name"), MAILBOX_NAME, USER_1, prefix + SET_RIGHTS); subject.doProcess(r, responder, imapSession); verify(mailboxManager).applyRightsCommand(path, MailboxACL.command().key(user1Key).rights(setRights).mode(editMode).build(), mailboxSession); verify(responder, times(1)).respond(argumentCaptor.capture()); verifyNoMoreInteractions(responder); assertThat(argumentCaptor.getAllValues()) .hasSize(1); assertThat(argumentCaptor.getAllValues().get(0)) .matches(StatusResponseTypeMatcher.OK_RESPONSE_MATCHER::matches); }
mailboxManager.applyRightsCommand(mailboxPath, MailboxACL.command().key(key).mode(editMode).rights(mailboxAclRights).build(), mailboxSession);
mailboxManager.applyRightsCommand( mailboxPath, MailboxACL.command().key(key).noRights().asReplacement(),