Search in sources :

Example 6 with LockoutMailboxRequest

use of com.zimbra.soap.admin.message.LockoutMailboxRequest in project zm-mailbox by Zimbra.

the class ProvUtil method sendMailboxLockoutRequest.

private void sendMailboxLockoutRequest(String acctName, String server, String operation) throws ServiceException, IOException {
    LockoutMailboxRequest req = LockoutMailboxRequest.create(AccountNameSelector.fromName(acctName));
    req.setOperation(operation);
    String url = URLUtil.getAdminURL(server);
    ZAuthToken token = ((SoapProvisioning) prov).getAuthToken();
    SoapHttpTransport transport = new SoapHttpTransport(url);
    transport.setAuthToken(token);
    transport.invokeWithoutSession(JaxbUtil.jaxbToElement(req));
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) SoapHttpTransport(com.zimbra.common.soap.SoapHttpTransport) ZAuthToken(com.zimbra.common.auth.ZAuthToken) LockoutMailboxRequest(com.zimbra.soap.admin.message.LockoutMailboxRequest)

Example 7 with LockoutMailboxRequest

use of com.zimbra.soap.admin.message.LockoutMailboxRequest in project zm-mailbox by Zimbra.

the class TestLockoutMailbox method testUnlock.

@Test
public void testUnlock() throws Exception {
    Mailbox mbox = TestUtil.getMailbox(MY_USER);
    TestUtil.addMessage(mbox, "test");
    TestUtil.waitForMessage(TestUtil.getZMailbox(MY_USER), "test");
    assertFalse("mailbox should not be locked yet", MailboxManager.getInstance().isMailboxLockedOut(mbox.getAccountId()));
    MailboxManager.getInstance().lockoutMailbox(mbox.getAccountId());
    assertTrue("mailbox should be locked now", MailboxManager.getInstance().isMailboxLockedOut(mbox.getAccountId()));
    LockoutMailboxRequest req = LockoutMailboxRequest.create(AccountNameSelector.fromName(MY_USER));
    req.setOperation(AdminConstants.A_END);
    LockoutMailboxResponse resp = adminSoapProv.invokeJaxb(req);
    assertNotNull("LockoutMailboxRequest return null response", resp);
    assertFalse("mailbox should not be locked any more", MailboxManager.getInstance().isMailboxLockedOut(mbox.getAccountId()));
}
Also used : LockoutMailboxResponse(com.zimbra.soap.admin.message.LockoutMailboxResponse) LockoutMailbox(com.zimbra.cs.service.admin.LockoutMailbox) Mailbox(com.zimbra.cs.mailbox.Mailbox) LockoutMailboxRequest(com.zimbra.soap.admin.message.LockoutMailboxRequest) Test(org.junit.Test)

Aggregations

LockoutMailboxRequest (com.zimbra.soap.admin.message.LockoutMailboxRequest)7 Mailbox (com.zimbra.cs.mailbox.Mailbox)5 LockoutMailbox (com.zimbra.cs.service.admin.LockoutMailbox)5 Test (org.junit.Test)5 LockoutMailboxResponse (com.zimbra.soap.admin.message.LockoutMailboxResponse)4 SoapFaultException (com.zimbra.common.soap.SoapFaultException)3 AdminRight (com.zimbra.cs.account.accesscontrol.AdminRight)2 AdminDocumentHandler (com.zimbra.cs.service.admin.AdminDocumentHandler)2 ArrayList (java.util.ArrayList)2 AccountBy (com.zimbra.common.account.Key.AccountBy)1 ZAuthToken (com.zimbra.common.auth.ZAuthToken)1 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)1 Account (com.zimbra.cs.account.Account)1 Provisioning (com.zimbra.cs.account.Provisioning)1 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 AccountNameSelector (com.zimbra.soap.type.AccountNameSelector)1