Search in sources :

Example 11 with CreateDistributionListRequest

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

the class TestDomainAdmin method testModifyDistributionListInDiffDomain.

@Test
public void testModifyDistributionListInDiffDomain() 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, "testGetDistributionListInDiffDomain Room 101"));
    CreateDistributionListResponse caResp;
    caResp = adminSoapProv.invokeJaxb(new CreateDistributionListRequest(DIFF_DL, attrs, false));
    assertNotNull("CreateDistributionListResponse for " + DIFF_DL + " as FULL ADMIN", caResp);
    String dlId = caResp.getDl().getId();
    ModifyDistributionListRequest modAcctReq = new ModifyDistributionListRequest(dlId);
    modAcctReq.addAttr(new Attr(Provisioning.A_description, "dummy description"));
    try {
        domAdminSoapProv.invokeJaxb(modAcctReq);
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "permission denied: can not access distribution list ");
    }
    DeleteDistributionListRequest delAcctReq = new DeleteDistributionListRequest(dlId);
    DeleteDistributionListResponse delAcctResp = adminSoapProv.invokeJaxb(delAcctReq);
    assertNotNull("DeleteDistributionListResponse for " + DIFF_DL + " as ADMIN", delAcctResp);
    try {
        domAdminSoapProv.invokeJaxb(modAcctReq);
        fail("ModifyDistributionListRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        // Get this instead of "no such distribution list" 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 ");
    }
}
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) Test(org.junit.Test)

Aggregations

CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)11 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)10 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 Element (com.zimbra.common.soap.Element)1 Domain (com.zimbra.cs.account.Domain)1 Group (com.zimbra.cs.account.Group)1 Provisioning (com.zimbra.cs.account.Provisioning)1