use of com.zimbra.soap.admin.type.Attr 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();
}
use of com.zimbra.soap.admin.type.Attr 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.type.Attr in project zm-mailbox by Zimbra.
the class JaxbToElementTest method jaxbSubclassFixupTest.
/**
* Check that @{link JaxbUtil.elementToJaxb} will accept XML where
* JAXB expects various attributes that have been specified as elements.
* Ensure that attributes in elements of superclasses are handled
* In this case:
* <a><n>attrName1</n></a>
* should be recognised as meaning:
* <a n="attrName1"></a>
* @throws Exception
*/
@Test
public void jaxbSubclassFixupTest() throws Exception {
Element rootElem = Element.XMLElement.mFactory.createElement(AdminConstants.CREATE_ACCOUNT_REQUEST);
// JAXB Attribute E_NAME
rootElem.addNonUniqueElement(AdminConstants.E_NAME).addText("acctName");
// JAXB Attribute E_PASSWORD
rootElem.addNonUniqueElement(AdminConstants.E_PASSWORD).addText("AcctPassword");
// JAXB Element E_A ---> Attr (actually a List)
Element a1 = rootElem.addNonUniqueElement(AdminConstants.E_A);
// JAXB Attribute A_N
a1.addNonUniqueElement(AdminConstants.A_N).addText("attrName1");
// value can't be set when we've specified an attribute as an element
CreateAccountRequest req = JaxbUtil.elementToJaxb(rootElem);
Assert.assertEquals("Account name", "acctName", req.getName());
Assert.assertEquals("Account Password", "AcctPassword", req.getPassword());
List<Attr> attrs = req.getAttrs();
Assert.assertEquals("Number of attrs", 1, attrs.size());
Assert.assertEquals("attr 1 name", "attrName1", attrs.get(0).getKey());
Assert.assertEquals("attr 1 value", "", attrs.get(0).getValue());
}
use of com.zimbra.soap.admin.type.Attr in project zm-mailbox by Zimbra.
the class TestDomainAdmin method testGetCalendarResourceInDiffDomain.
@Test
public void testGetCalendarResourceInDiffDomain() 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, "testGetCalendarResourceInDiffDomain Room 101"));
attrs.add(new Attr(Provisioning.A_description, "Room 101 for 50 seats"));
attrs.add(new Attr(Provisioning.A_zimbraCalResType, "Location"));
attrs.add(new Attr(Provisioning.A_zimbraCalResAutoAcceptDecline, "TRUE"));
attrs.add(new Attr(Provisioning.A_zimbraCalResAutoDeclineIfBusy, "TRUE"));
CreateCalendarResourceResponse caResp;
try {
caResp = domAdminSoapProv.invokeJaxb(new CreateCalendarResourceRequest(DIFF_CALRES, TestUtil.DEFAULT_PASSWORD, attrs));
fail("CreateCalendarResourceRequest succeeded for account in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: need right: createCalendarResource for domain");
}
caResp = adminSoapProv.invokeJaxb(new CreateCalendarResourceRequest(DIFF_CALRES, TestUtil.DEFAULT_PASSWORD, attrs));
assertNotNull("CreateCalendarResourceResponse for " + DIFF_CALRES + " simple as domAdmin", caResp);
String acctId = caResp.getCalResource().getId();
GetCalendarResourceRequest getAcctReq = new GetCalendarResourceRequest(CalendarResourceSelector.fromName(DIFF_CALRES), true);
try {
domAdminSoapProv.invokeJaxb(getAcctReq);
fail("GetCalendarResourceRequest succeeded for account in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
try {
domAdminSoapProv.invokeJaxbOnTargetAccount(getAcctReq, acctId);
fail("GetCalendarResourceRequest succeeded for account in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
// try non-existent
getAcctReq = new GetCalendarResourceRequest(CalendarResourceSelector.fromName(DIFF_CALRES2), true);
try {
domAdminSoapProv.invokeJaxb(getAcctReq);
fail("GetCalendarResourceRequest succeeded for non-existent account in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
try {
domAdminSoapProv.invokeJaxb(new RenameCalendarResourceRequest(acctId, TARGET_CALRES_RENAMED));
fail("RenameCalendarResourceRequest succeeded for account in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
try {
domAdminSoapProv.invokeJaxb(new DeleteCalendarResourceRequest(acctId));
fail("DeleteCalendarResourceRequest succeeded for account in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
}
use of com.zimbra.soap.admin.type.Attr 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");
}
Aggregations