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);
}
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;
}
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");
}
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 ");
}
}
Aggregations