Search in sources :

Example 1 with CreateAccountResponse

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

the class TestDomainAdmin method createAdminConsoleStyleDomainAdmin.

public String createAdminConsoleStyleDomainAdmin(String domAdminName) throws ServiceException {
    List<Attr> attrs = Lists.newArrayList();
    attrs.add(new Attr(Provisioning.A_zimbraIsDelegatedAdminAccount, "TRUE"));
    attrs.add(new Attr(Provisioning.A_zimbraAdminConsoleUIComponents, "accountListView"));
    attrs.add(new Attr(Provisioning.A_zimbraAdminConsoleUIComponents, "downloadsView"));
    attrs.add(new Attr(Provisioning.A_zimbraAdminConsoleUIComponents, "DLListView"));
    attrs.add(new Attr(Provisioning.A_zimbraAdminConsoleUIComponents, "aliasListView"));
    attrs.add(new Attr(Provisioning.A_zimbraAdminConsoleUIComponents, "resourceListView"));
    attrs.add(new Attr(Provisioning.A_zimbraAdminConsoleUIComponents, "saveSearch"));
    CreateAccountRequest caReq = new CreateAccountRequest(domAdminName, TestUtil.DEFAULT_PASSWORD, attrs);
    CreateAccountResponse caResp = adminSoapProv.invokeJaxb(caReq);
    assertNotNull("CreateAccountResponse for " + domAdminName, caResp);
    grantRight(adminSoapProv, TargetType.domain, ADMINISTERED_DOMAIN, domAdminName, RightConsts.RT_domainAdminConsoleRights);
    grantRight(adminSoapProv, TargetType.global, "globalacltarget", domAdminName, RightConsts.RT_domainAdminZimletRights);
    grantRight(adminSoapProv, TargetType.global, "globalacltarget", domAdminName, RightConsts.RT_adminLoginCalendarResourceAs);
    adminSoapProv.flushCache(CacheEntryType.acl, null);
    return caResp.getAccount().getId();
}
Also used : CreateAccountRequest(com.zimbra.soap.admin.message.CreateAccountRequest) CreateAccountResponse(com.zimbra.soap.admin.message.CreateAccountResponse) Attr(com.zimbra.soap.admin.type.Attr)

Example 2 with CreateAccountResponse

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

the class TestDomainAdmin method testViaGroupDelegatedAdminAssignSendToDistList.

/**
 * Test that delegated admin with adminConsoleDLACLTabRights can grant sendToDistList right
 * @throws Exception
 */
@Test
public void testViaGroupDelegatedAdminAssignSendToDistList() throws Exception {
    String domAdminGroupId = createAdminConsoleStyleDomainAdminGroup(DOMADMINGROUP);
    CreateAccountResponse caResp;
    List<Attr> attrs = Lists.newArrayList();
    attrs.add(new Attr(Provisioning.A_zimbraIsDelegatedAdminAccount, "TRUE"));
    CreateAccountRequest caReq = new CreateAccountRequest(DOMADMIN, TestUtil.DEFAULT_PASSWORD, attrs);
    caResp = adminSoapProv.invokeJaxb(caReq);
    assertNotNull("CreateAccountResponse for " + DOMADMIN + " Admin", caResp);
    AddDistributionListMemberResponse adlmResp;
    adlmResp = adminSoapProv.invokeJaxb(new AddDistributionListMemberRequest(domAdminGroupId, Lists.newArrayList(DOMADMIN)));
    assertNotNull("AddDistributionListMemberResponse for " + DOMADMIN + " Admin", adlmResp);
    adminSoapProv.createAccount(TARGET_ACCT, TestUtil.DEFAULT_PASSWORD, null);
    SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
    CreateDistributionListResponse cdlResp;
    cdlResp = domAdminSoapProv.invokeJaxb(new CreateDistributionListRequest(TARGET_DL));
    assertNotNull("CreateDistributionListResponse for " + TARGET_DL + " simple as domAdmin", cdlResp);
    cdlResp = adminSoapProv.invokeJaxb(new CreateDistributionListRequest(DIFF_DL));
    assertNotNull("CreateDistributionListResponse for " + TARGET_DL + " simple as domAdmin", cdlResp);
    failToGrantRight(domAdminSoapProv, TargetType.dl, TARGET_DL, TARGET_ACCT, RightConsts.RT_sendToDistList, "permission denied: insufficient right to grant 'sendToDistList' right");
    grantRight(adminSoapProv, TargetType.domain, ADMINISTERED_DOMAIN, GranteeType.grp, DOMADMINGROUP, RightConsts.RT_adminConsoleDLACLTabRights);
    grantRight(domAdminSoapProv, TargetType.dl, TARGET_DL, TARGET_ACCT, RightConsts.RT_sendToDistList);
    /* Check that doesn't allow it for a dl in a different domain */
    failToGrantRight(domAdminSoapProv, TargetType.dl, DIFF_DL, TARGET_ACCT, RightConsts.RT_sendToDistList, "permission denied: insufficient right to grant 'sendToDistList' right");
}
Also used : CreateAccountResponse(com.zimbra.soap.admin.message.CreateAccountResponse) CreateAccountRequest(com.zimbra.soap.admin.message.CreateAccountRequest) AddDistributionListMemberResponse(com.zimbra.soap.admin.message.AddDistributionListMemberResponse) AddDistributionListMemberRequest(com.zimbra.soap.admin.message.AddDistributionListMemberRequest) CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) Attr(com.zimbra.soap.admin.type.Attr) Test(org.junit.Test)

Example 3 with CreateAccountResponse

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

the class TestDomainAdmin method testGetAccountInDomAdminDomain.

@Test
public void testGetAccountInDomAdminDomain() throws Exception {
    String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
    SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
    CreateAccountResponse caResp;
    caResp = domAdminSoapProv.invokeJaxb(new CreateAccountRequest(TARGET_ACCT, TestUtil.DEFAULT_PASSWORD));
    assertNotNull("CreateAccountResponse for " + TARGET_ACCT + " simple as domAdmin", caResp);
    String acctId = caResp.getAccount().getId();
    GetAccountRequest getAcctReq = new GetAccountRequest(AccountSelector.fromName(TARGET_ACCT), true);
    GetAccountResponse getAcctResp = domAdminSoapProv.invokeJaxb(getAcctReq);
    assertNotNull("GetAccountResponse for " + TARGET_ACCT + " simple as domAdmin", getAcctResp);
    getAcctResp = domAdminSoapProv.invokeJaxbOnTargetAccount(getAcctReq, acctId);
    assertNotNull("GetAccountResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", getAcctResp);
    GetMailboxRequest gmReq = new GetMailboxRequest(new MailboxByAccountIdSelector(acctId));
    GetMailboxResponse gmResp = domAdminSoapProv.invokeJaxb(gmReq);
    assertNotNull("GetMailboxResponse for " + TARGET_ACCT + " simple as domAdmin", gmResp);
    gmResp = domAdminSoapProv.invokeJaxbOnTargetAccount(gmReq, acctId);
    assertNotNull("GetMailboxResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", gmResp);
    AddAccountAliasResponse aaaResp;
    aaaResp = domAdminSoapProv.invokeJaxb(new AddAccountAliasRequest(acctId, ALIAS_FOR_TARGET_ACCT));
    assertNotNull("AddAccountAliasResponse for " + TARGET_ACCT + " simple as domAdmin", aaaResp);
    aaaResp = domAdminSoapProv.invokeJaxbOnTargetAccount(new AddAccountAliasRequest(acctId, ALIAS_FOR_TARGET_ACCT2), acctId);
    assertNotNull("AddAccountAliasResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", aaaResp);
    RemoveAccountAliasResponse daaResp;
    daaResp = domAdminSoapProv.invokeJaxb(new RemoveAccountAliasRequest(acctId, ALIAS_FOR_TARGET_ACCT));
    assertNotNull("RemoveAccountAliasResponse for " + TARGET_ACCT + " simple as domAdmin", daaResp);
    daaResp = domAdminSoapProv.invokeJaxbOnTargetAccount(new RemoveAccountAliasRequest(acctId, ALIAS_FOR_TARGET_ACCT2), acctId);
    assertNotNull("RemoveAccountAliasResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", daaResp);
    RenameAccountResponse renAResp;
    renAResp = domAdminSoapProv.invokeJaxb(new RenameAccountRequest(acctId, TARGET_ACCT_RENAMED));
    assertNotNull("RenameAccountResponse for " + TARGET_ACCT + " simple as domAdmin", renAResp);
    renAResp = domAdminSoapProv.invokeJaxb(new RenameAccountRequest(acctId, TARGET_ACCT));
    assertNotNull("RenameAccountResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", renAResp);
    DeleteAccountRequest delAcctReq;
    DeleteAccountResponse delAcctResp;
    delAcctReq = new DeleteAccountRequest(null);
    try {
        delAcctResp = domAdminSoapProv.invokeJaxbOnTargetAccount(delAcctReq, acctId);
        fail("DeleteAccountRequest succeeded in spite of having no 'id' specified!!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "invalid request: missing required attribute: id");
    }
    delAcctReq = new DeleteAccountRequest(acctId);
    delAcctResp = domAdminSoapProv.invokeJaxbOnTargetAccount(delAcctReq, acctId);
    assertNotNull("DeleteAccountResponse for " + TARGET_ACCT + " as domAdmin specifying target acct", delAcctResp);
    try {
        getAcctResp = domAdminSoapProv.invokeJaxb(getAcctReq);
        fail("GetAccountRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "no such account: ");
    }
    try {
        getAcctResp = domAdminSoapProv.invokeJaxb(new GetAccountRequest(AccountSelector.fromId(acctId), true));
        fail("GetAccountRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        // because by id not name
        checkSoapReason(sfe, "permission denied: can not access account ");
    }
    try {
        getAcctResp = domAdminSoapProv.invokeJaxbOnTargetAccount(getAcctReq, acctId);
        fail("GetAccountRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access account ");
    }
    try {
        gmResp = domAdminSoapProv.invokeJaxb(gmReq);
        fail("GetMailboxRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        // because by id
        checkSoapReason(sfe, "permission denied: can not access account ");
    }
    try {
        gmResp = domAdminSoapProv.invokeJaxbOnTargetAccount(gmReq, acctId);
        fail("GetMailboxRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access account ");
    }
}
Also used : CreateAccountResponse(com.zimbra.soap.admin.message.CreateAccountResponse) DeleteAccountRequest(com.zimbra.soap.admin.message.DeleteAccountRequest) AddAccountAliasRequest(com.zimbra.soap.admin.message.AddAccountAliasRequest) RemoveAccountAliasRequest(com.zimbra.soap.admin.message.RemoveAccountAliasRequest) DeleteAccountResponse(com.zimbra.soap.admin.message.DeleteAccountResponse) RenameAccountRequest(com.zimbra.soap.admin.message.RenameAccountRequest) GetMailboxResponse(com.zimbra.soap.admin.message.GetMailboxResponse) MailboxByAccountIdSelector(com.zimbra.soap.admin.type.MailboxByAccountIdSelector) GetAccountRequest(com.zimbra.soap.admin.message.GetAccountRequest) SoapFaultException(com.zimbra.common.soap.SoapFaultException) GetAccountResponse(com.zimbra.soap.admin.message.GetAccountResponse) RemoveAccountAliasResponse(com.zimbra.soap.admin.message.RemoveAccountAliasResponse) CreateAccountRequest(com.zimbra.soap.admin.message.CreateAccountRequest) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) GetMailboxRequest(com.zimbra.soap.admin.message.GetMailboxRequest) RenameAccountResponse(com.zimbra.soap.admin.message.RenameAccountResponse) AddAccountAliasResponse(com.zimbra.soap.admin.message.AddAccountAliasResponse) Test(org.junit.Test)

Aggregations

CreateAccountRequest (com.zimbra.soap.admin.message.CreateAccountRequest)3 CreateAccountResponse (com.zimbra.soap.admin.message.CreateAccountResponse)3 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)2 Attr (com.zimbra.soap.admin.type.Attr)2 Test (org.junit.Test)2 SoapFaultException (com.zimbra.common.soap.SoapFaultException)1 AddAccountAliasRequest (com.zimbra.soap.admin.message.AddAccountAliasRequest)1 AddAccountAliasResponse (com.zimbra.soap.admin.message.AddAccountAliasResponse)1 AddDistributionListMemberRequest (com.zimbra.soap.admin.message.AddDistributionListMemberRequest)1 AddDistributionListMemberResponse (com.zimbra.soap.admin.message.AddDistributionListMemberResponse)1 CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)1 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)1 DeleteAccountRequest (com.zimbra.soap.admin.message.DeleteAccountRequest)1 DeleteAccountResponse (com.zimbra.soap.admin.message.DeleteAccountResponse)1 GetAccountRequest (com.zimbra.soap.admin.message.GetAccountRequest)1 GetAccountResponse (com.zimbra.soap.admin.message.GetAccountResponse)1 GetMailboxRequest (com.zimbra.soap.admin.message.GetMailboxRequest)1 GetMailboxResponse (com.zimbra.soap.admin.message.GetMailboxResponse)1 RemoveAccountAliasRequest (com.zimbra.soap.admin.message.RemoveAccountAliasRequest)1 RemoveAccountAliasResponse (com.zimbra.soap.admin.message.RemoveAccountAliasResponse)1