Search in sources :

Example 6 with CreateDistributionListRequest

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

the class TestJaxbProvisioning method doRenameDynamicGroupTest.

private void doRenameDynamicGroupTest(boolean isACLGroup, String displayName, String memberURL) throws ServiceException {
    List<Attr> attrs = Lists.newArrayList();
    attrs.add(new Attr("zimbraIsACLGroup", isACLGroup ? "TRUE" : "FALSE"));
    attrs.add(new Attr("zimbraMailStatus", "enabled"));
    attrs.add(new Attr("displayName", displayName));
    if (memberURL != null) {
        attrs.add(new Attr("memberURL", memberURL));
    }
    Domain dom = ensureDomainExists(testDlDomain);
    assertNotNull(String.format("Domain for %s", testDlDomain), dom);
    deleteDlIfExists(testDl);
    CreateDistributionListResponse cdlResp = prov.invokeJaxb(new CreateDistributionListRequest(testDl, attrs, true));
    assertNotNull("CreateDistributionListResponse", cdlResp);
    RenameDistributionListResponse rdlResp = prov.invokeJaxb(new RenameDistributionListRequest(cdlResp.getDl().getId(), testDlNewName));
    assertNotNull("RenameDistributionListResponse", rdlResp);
}
Also used : RenameDistributionListResponse(com.zimbra.soap.admin.message.RenameDistributionListResponse) RenameDistributionListRequest(com.zimbra.soap.admin.message.RenameDistributionListRequest) CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) Domain(com.zimbra.cs.account.Domain) Attr(com.zimbra.soap.admin.type.Attr)

Example 7 with CreateDistributionListRequest

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

the class CreateDistributionList method handle.

@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    Provisioning prov = Provisioning.getInstance();
    CreateDistributionListRequest req = JaxbUtil.elementToJaxb(request);
    String name = req.getName().toLowerCase();
    Map<String, Object> attrs = req.getAttrsAsOldMultimap(true);
    boolean dynamic = Boolean.TRUE.equals(req.getDynamic());
    if (dynamic) {
        checkDomainRightByEmail(zsc, name, Admin.R_createGroup);
        checkSetAttrsOnCreate(zsc, TargetType.group, name, attrs);
    } else {
        checkDomainRightByEmail(zsc, name, Admin.R_createDistributionList);
        checkSetAttrsOnCreate(zsc, TargetType.dl, name, attrs);
    }
    Group group = prov.createGroup(name, attrs, dynamic);
    ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "CreateDistributionList", "name", name }, attrs));
    Element response = zsc.createElement(AdminConstants.CREATE_DISTRIBUTION_LIST_RESPONSE);
    GetDistributionList.encodeDistributionList(response, group);
    return response;
}
Also used : Group(com.zimbra.cs.account.Group) CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element) Provisioning(com.zimbra.cs.account.Provisioning)

Example 8 with CreateDistributionListRequest

use of com.zimbra.soap.admin.message.CreateDistributionListRequest 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 9 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)9 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 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