Search in sources :

Example 1 with CreateDistributionListResponse

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

the class TestDomainAdmin method testDelegatedAdminAssignSendToDistList.

/**
     * Test that delegated admin with adminConsoleDLACLTabRights can grant sendToDistList right
     * @throws Exception
     */
@Test
public void testDelegatedAdminAssignSendToDistList() throws Exception {
    createAdminConsoleStyleDomainAdmin(DOMADMIN);
    adminSoapProv.createAccount(TARGET_ACCT, TestUtil.DEFAULT_PASSWORD, null);
    SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
    CreateDistributionListResponse caResp;
    caResp = domAdminSoapProv.invokeJaxb(new CreateDistributionListRequest(TARGET_DL));
    assertNotNull("CreateDistributionListResponse for " + TARGET_DL + " simple as domAdmin", caResp);
    caResp = adminSoapProv.invokeJaxb(new CreateDistributionListRequest(DIFF_DL));
    assertNotNull("CreateDistributionListResponse for " + TARGET_DL + " simple as domAdmin", caResp);
    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, DOMADMIN, /* grantee */
    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 : CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) Test(org.junit.Test)

Example 2 with CreateDistributionListResponse

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

the class TestDomainAdmin method testGetDistributionListInDomAdminDomain.

@Test
public void testGetDistributionListInDomAdminDomain() throws Exception {
    String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
    SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
    CreateDistributionListResponse caResp;
    caResp = domAdminSoapProv.invokeJaxb(new CreateDistributionListRequest(TARGET_DL));
    assertNotNull("CreateDistributionListResponse for " + TARGET_DL + " simple as domAdmin", caResp);
    String dlId = caResp.getDl().getId();
    GetDistributionListRequest getDlReq = new GetDistributionListRequest(DistributionListSelector.fromName(TARGET_DL));
    GetDistributionListResponse getDlResp = domAdminSoapProv.invokeJaxb(getDlReq);
    assertNotNull("GetDistributionListResponse for " + TARGET_DL + " simple as domAdmin", getDlResp);
    AddDistributionListAliasResponse aaaResp;
    aaaResp = domAdminSoapProv.invokeJaxb(new AddDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
    assertNotNull("AddDistributionListAliasResponse for " + TARGET_DL + " simple as domAdmin", aaaResp);
    RemoveDistributionListAliasResponse daaResp;
    daaResp = domAdminSoapProv.invokeJaxb(new RemoveDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
    assertNotNull("RemoveDistributionListAliasResponse for " + TARGET_DL + " simple as domAdmin", daaResp);
    RenameDistributionListResponse renAResp;
    renAResp = domAdminSoapProv.invokeJaxb(new RenameDistributionListRequest(dlId, TARGET_DL_RENAMED));
    assertNotNull("RenameDistributionListResponse for " + TARGET_DL + " simple as domAdmin", renAResp);
    DeleteDistributionListRequest delDLReq;
    DeleteDistributionListResponse delDlResp;
    delDLReq = new DeleteDistributionListRequest(null);
    try {
        delDlResp = domAdminSoapProv.invokeJaxb(delDLReq);
        fail("DeleteDistributionListRequest succeeded in spite of having no 'id' specified!!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "invalid request: missing required attribute: id");
    }
    delDLReq = new DeleteDistributionListRequest(dlId);
    delDlResp = domAdminSoapProv.invokeJaxb(delDLReq);
    assertNotNull("DeleteDistributionListResponse for " + TARGET_DL + " as domAdmin", delDlResp);
    try {
        getDlResp = domAdminSoapProv.invokeJaxb(getDlReq);
        fail("GetDistributionListRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "no such distribution list:");
    }
    try {
        getDlResp = domAdminSoapProv.invokeJaxb(new GetDistributionListRequest(DistributionListSelector.fromId(dlId)));
        fail("GetDistributionListRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        // because by id not name
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
}
Also used : GetDistributionListResponse(com.zimbra.soap.admin.message.GetDistributionListResponse) RemoveDistributionListAliasRequest(com.zimbra.soap.admin.message.RemoveDistributionListAliasRequest) AddDistributionListAliasRequest(com.zimbra.soap.admin.message.AddDistributionListAliasRequest) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) GetDistributionListRequest(com.zimbra.soap.admin.message.GetDistributionListRequest) SoapFaultException(com.zimbra.common.soap.SoapFaultException) RemoveDistributionListAliasResponse(com.zimbra.soap.admin.message.RemoveDistributionListAliasResponse) RenameDistributionListResponse(com.zimbra.soap.admin.message.RenameDistributionListResponse) RenameDistributionListRequest(com.zimbra.soap.admin.message.RenameDistributionListRequest) CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) DeleteDistributionListRequest(com.zimbra.soap.admin.message.DeleteDistributionListRequest) DeleteDistributionListResponse(com.zimbra.soap.admin.message.DeleteDistributionListResponse) AddDistributionListAliasResponse(com.zimbra.soap.admin.message.AddDistributionListAliasResponse) Test(org.junit.Test)

Example 3 with CreateDistributionListResponse

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

the class TestDomainAdmin method testGetDistributionListInDiffDomain.

@Test
public void testGetDistributionListInDiffDomain() throws Exception {
    String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
    CreateDistributionListResponse caResp;
    caResp = adminSoapProv.invokeJaxb(new CreateDistributionListRequest(DIFF_DL));
    assertNotNull("CreateDistributionListResponse for " + DIFF_DL + " as FULL ADMIN", caResp);
    String dlId = caResp.getDl().getId();
    SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
    GetDistributionListRequest getAcctReq = new GetDistributionListRequest(DistributionListSelector.fromName(DIFF_DL));
    try {
        domAdminSoapProv.invokeJaxb(getAcctReq);
        fail("GetDistributionListRequest succeeded for DistributionList in other domain!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
    // try non-existent acct
    getAcctReq = new GetDistributionListRequest(DistributionListSelector.fromName(DIFF_DL2));
    try {
        domAdminSoapProv.invokeJaxb(getAcctReq);
        fail("GetDistributionListRequest succeeded for non-existent DistributionList in other domain!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
    AddDistributionListAliasResponse aaaResp;
    try {
        aaaResp = domAdminSoapProv.invokeJaxb(new AddDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
        fail("AddDistributionListAliasRequest succeeded for DistributionList in other domain!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
    aaaResp = adminSoapProv.invokeJaxb(new AddDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
    assertNotNull("AddDistributionListAliasResponse for " + TARGET_DL + " as FULL ADMIN", aaaResp);
    try {
        domAdminSoapProv.invokeJaxb(new RemoveDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
        fail("RemoveDistributionListAliasRequest succeeded for DistributionList in other domain!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
    try {
        domAdminSoapProv.invokeJaxb(new RenameDistributionListRequest(dlId, TARGET_DL_RENAMED));
        fail("RenameDistributionListRequest succeeded for DistributionList in other domain!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
    try {
        domAdminSoapProv.invokeJaxb(new DeleteDistributionListRequest(dlId));
        fail("DeleteDistributionListRequest succeeded for DistributionList in other domain!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
}
Also used : RenameDistributionListRequest(com.zimbra.soap.admin.message.RenameDistributionListRequest) CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) RemoveDistributionListAliasRequest(com.zimbra.soap.admin.message.RemoveDistributionListAliasRequest) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) AddDistributionListAliasRequest(com.zimbra.soap.admin.message.AddDistributionListAliasRequest) DeleteDistributionListRequest(com.zimbra.soap.admin.message.DeleteDistributionListRequest) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) GetDistributionListRequest(com.zimbra.soap.admin.message.GetDistributionListRequest) AddDistributionListAliasResponse(com.zimbra.soap.admin.message.AddDistributionListAliasResponse) SoapFaultException(com.zimbra.common.soap.SoapFaultException) Test(org.junit.Test)

Example 4 with CreateDistributionListResponse

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

the class TestDomainAdmin method createAdminConsoleStyleDomainAdminGroup.

public String createAdminConsoleStyleDomainAdminGroup(String domAdminGrp) throws ServiceException {
    CreateDistributionListResponse cdlResp;
    CreateDistributionListRequest cdlReq = new CreateDistributionListRequest(domAdminGrp);
    cdlReq.addAttr(new Attr(Provisioning.A_zimbraIsAdminGroup, "TRUE"));
    cdlResp = adminSoapProv.invokeJaxb(cdlReq);
    assertNotNull("CreateDistributionListResponse for " + cdlReq.getName() + " as Admin", cdlResp);
    List<Attr> attrs = Lists.newArrayList();
    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"));
    ModifyDistributionListResponse mdlResp = adminSoapProv.invokeJaxb(new ModifyDistributionListRequest(cdlResp.getDl().getId(), attrs));
    assertNotNull("ModifyDistributionListResponse for " + cdlReq.getName() + " as Admin", mdlResp);
    grantRight(adminSoapProv, TargetType.domain, ADMINISTERED_DOMAIN, GranteeType.grp, domAdminGrp, RightConsts.RT_domainAdminConsoleRights);
    grantRight(adminSoapProv, TargetType.global, "globalacltarget", GranteeType.grp, domAdminGrp, RightConsts.RT_domainAdminZimletRights);
    grantRight(adminSoapProv, TargetType.global, "globalacltarget", GranteeType.grp, domAdminGrp, RightConsts.RT_adminLoginCalendarResourceAs);
    adminSoapProv.flushCache(CacheEntryType.acl, null);
    return cdlResp.getDl().getId();
}
Also used : CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) ModifyDistributionListRequest(com.zimbra.soap.admin.message.ModifyDistributionListRequest) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) Attr(com.zimbra.soap.admin.type.Attr) ModifyDistributionListResponse(com.zimbra.soap.admin.message.ModifyDistributionListResponse)

Example 5 with CreateDistributionListResponse

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

the class TestDomainAdmin method testModifyDistributionListInDomAdminDomain.

@Test
public void testModifyDistributionListInDomAdminDomain() throws Exception {
    String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
    SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
    List<Attr> attrs = Lists.newArrayList();
    attrs.add(new Attr(Provisioning.A_displayName, "testModifyDistributionListInDomAdminDomain"));
    CreateDistributionListResponse caResp;
    caResp = domAdminSoapProv.invokeJaxb(new CreateDistributionListRequest(TARGET_DL, attrs, false));
    assertNotNull("CreateDistributionListResponse for " + TARGET_DL + " simple as domAdmin", caResp);
    String dlId = caResp.getDl().getId();
    ModifyDistributionListRequest modDlReq;
    ModifyDistributionListResponse modDlResp;
    modDlReq = new ModifyDistributionListRequest(null);
    modDlReq.addAttr(new Attr(Provisioning.A_description, "dummy description"));
    try {
        modDlResp = domAdminSoapProv.invokeJaxb(modDlReq);
        fail("ModifyDistributionListRequest succeeded without specifying id!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "invalid request: missing required attribute: id");
    }
    modDlReq = new ModifyDistributionListRequest(dlId);
    modDlReq.addAttr(new Attr(Provisioning.A_description, "dummy description"));
    modDlResp = domAdminSoapProv.invokeJaxb(modDlReq);
    assertNotNull("ModifyDistributionListResponse for " + TARGET_DL2 + " simple as domAdmin", modDlResp);
    DeleteDistributionListRequest delDlReq = new DeleteDistributionListRequest(dlId);
    DeleteDistributionListResponse delDlResp = domAdminSoapProv.invokeJaxb(delDlReq);
    assertNotNull("DeleteDistributionListResponse for " + TARGET_DL2 + " as domAdmin", delDlResp);
    try {
        modDlResp = domAdminSoapProv.invokeJaxb(modDlReq);
        fail("ModifyDistributionListRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        // Get this instead of "no such calendar resource: " because modify by ID (not name) and for domain admin
        // cannot know whether that ID was for a domain we administered or not.
        checkSoapReason(sfe, "permission denied: can not access distribution list ");
    }
    // as full admin
    try {
        modDlResp = adminSoapProv.invokeJaxb(modDlReq);
        fail("ModifyDistributionListRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        // Full admin gets "no such distribution list: " instead of "permission denied"
        checkSoapReason(sfe, "no such distribution list: ");
    }
}
Also used : CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) ModifyDistributionListRequest(com.zimbra.soap.admin.message.ModifyDistributionListRequest) DeleteDistributionListRequest(com.zimbra.soap.admin.message.DeleteDistributionListRequest) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) DeleteDistributionListResponse(com.zimbra.soap.admin.message.DeleteDistributionListResponse) Attr(com.zimbra.soap.admin.type.Attr) SoapFaultException(com.zimbra.common.soap.SoapFaultException) ModifyDistributionListResponse(com.zimbra.soap.admin.message.ModifyDistributionListResponse) Test(org.junit.Test)

Aggregations

CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)8 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)8 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)6 Test (org.junit.Test)6 Attr (com.zimbra.soap.admin.type.Attr)5 SoapFaultException (com.zimbra.common.soap.SoapFaultException)4 DeleteDistributionListRequest (com.zimbra.soap.admin.message.DeleteDistributionListRequest)4 DeleteDistributionListResponse (com.zimbra.soap.admin.message.DeleteDistributionListResponse)3 ModifyDistributionListRequest (com.zimbra.soap.admin.message.ModifyDistributionListRequest)3 RenameDistributionListRequest (com.zimbra.soap.admin.message.RenameDistributionListRequest)3 AddDistributionListAliasRequest (com.zimbra.soap.admin.message.AddDistributionListAliasRequest)2 AddDistributionListAliasResponse (com.zimbra.soap.admin.message.AddDistributionListAliasResponse)2 GetDistributionListRequest (com.zimbra.soap.admin.message.GetDistributionListRequest)2 ModifyDistributionListResponse (com.zimbra.soap.admin.message.ModifyDistributionListResponse)2 RemoveDistributionListAliasRequest (com.zimbra.soap.admin.message.RemoveDistributionListAliasRequest)2 RenameDistributionListResponse (com.zimbra.soap.admin.message.RenameDistributionListResponse)2 Domain (com.zimbra.cs.account.Domain)1 AddDistributionListMemberRequest (com.zimbra.soap.admin.message.AddDistributionListMemberRequest)1 AddDistributionListMemberResponse (com.zimbra.soap.admin.message.AddDistributionListMemberResponse)1 CreateAccountRequest (com.zimbra.soap.admin.message.CreateAccountRequest)1