Search in sources :

Example 1 with Attr

use of com.zimbra.soap.admin.type.Attr in project zm-mailbox by Zimbra.

the class GetAllConfigTest method unmarshallGetAllConfigResponseTest.

@Test
public void unmarshallGetAllConfigResponseTest() throws Exception {
    InputStream is = getClass().getResourceAsStream("GetAllConfigResponse.xml");
    Element elem = Element.parseXML(is);
    List<KeyValuePair> kvps = elem.listKeyValuePairs();
    is.close();
    is = getClass().getResourceAsStream("GetAllConfigResponse.xml");
    GetAllConfigResponse resp = (GetAllConfigResponse) unmarshaller.unmarshal(is);
    Assert.assertNotNull("Response", resp);
    List<Attr> attrs = resp.getAttrs();
    LOG.info("unmarshallGetAllConfigResponseTest:KVPS from elem=" + kvps.size() + " from jaxb=" + attrs.size());
    Assert.assertTrue("Have some attrs", attrs.size() > 20);
    Assert.assertEquals("Number of attrs from elem and from jaxb agree", kvps.size(), attrs.size());
}
Also used : KeyValuePair(com.zimbra.common.soap.Element.KeyValuePair) GetAllConfigResponse(com.zimbra.soap.admin.message.GetAllConfigResponse) InputStream(java.io.InputStream) Element(com.zimbra.common.soap.Element) Attr(com.zimbra.soap.admin.type.Attr) Test(org.junit.Test)

Example 2 with Attr

use of com.zimbra.soap.admin.type.Attr in project zm-mailbox by Zimbra.

the class SoapProvisioning method getConfig.

@Override
public Config getConfig(String needAttr) throws ServiceException {
    GetConfigRequest req = new GetConfigRequest();
    Attr attr = new Attr();
    attr.setKey(needAttr);
    req.setAttr(attr);
    GetConfigResponse resp = invokeJaxb(req);
    return new SoapConfig(resp, this);
}
Also used : GetConfigRequest(com.zimbra.soap.admin.message.GetConfigRequest) GetConfigResponse(com.zimbra.soap.admin.message.GetConfigResponse) Attr(com.zimbra.soap.admin.type.Attr)

Example 3 with Attr

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);
}
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 4 with Attr

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();
}
Also used : CreateAccountRequest(com.zimbra.soap.admin.message.CreateAccountRequest) CreateAccountResponse(com.zimbra.soap.admin.message.CreateAccountResponse) Attr(com.zimbra.soap.admin.type.Attr)

Example 5 with Attr

use of com.zimbra.soap.admin.type.Attr 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

Attr (com.zimbra.soap.admin.type.Attr)22 Test (org.junit.Test)17 SoapFaultException (com.zimbra.common.soap.SoapFaultException)15 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)10 CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)5 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)5 ModifyAccountRequest (com.zimbra.soap.admin.message.ModifyAccountRequest)5 ModifyCalendarResourceRequest (com.zimbra.soap.admin.message.ModifyCalendarResourceRequest)5 AdminRight (com.zimbra.cs.account.accesscontrol.AdminRight)4 AdminDocumentHandler (com.zimbra.cs.service.admin.AdminDocumentHandler)4 CreateCalendarResourceRequest (com.zimbra.soap.admin.message.CreateCalendarResourceRequest)4 CreateCalendarResourceResponse (com.zimbra.soap.admin.message.CreateCalendarResourceResponse)4 DeleteCalendarResourceRequest (com.zimbra.soap.admin.message.DeleteCalendarResourceRequest)4 ArrayList (java.util.ArrayList)4 CreateAccountRequest (com.zimbra.soap.admin.message.CreateAccountRequest)3 DeleteCalendarResourceResponse (com.zimbra.soap.admin.message.DeleteCalendarResourceResponse)3 ModifyDistributionListRequest (com.zimbra.soap.admin.message.ModifyDistributionListRequest)3 Element (com.zimbra.common.soap.Element)2 Account (com.zimbra.cs.account.Account)2 ModifyAccount (com.zimbra.cs.service.admin.ModifyAccount)2