Search in sources :

Example 6 with GetDistributionListRequest

use of com.zimbra.soap.account.message.GetDistributionListRequest in project zm-mailbox by Zimbra.

the class TestDelegatedDL method getDistributionListByGlobalAdmin.

/*
     * verify and request is allowed, but isOwner is false
     */
@Test
public void getDistributionListByGlobalAdmin() throws Exception {
    SoapTransport transport = authAdmin(ADMIN);
    GetDistributionListRequest req = new GetDistributionListRequest(DistributionListSelector.fromName(DL_NAME), Boolean.TRUE);
    GetDistributionListResponse resp = invokeJaxb(transport, req);
    DistributionListInfo dlInfo = resp.getDl();
    assertFalse(dlInfo.isOwner());
    String dlId = dlInfo.getId();
    Group group = prov.getGroup(Key.DistributionListBy.name, DL_NAME);
    assertNotNull(group);
    assertEquals(group.getId(), dlId);
}
Also used : GetDistributionListResponse(com.zimbra.soap.account.message.GetDistributionListResponse) Group(com.zimbra.cs.account.Group) DistributionListInfo(com.zimbra.soap.account.type.DistributionListInfo) GetDistributionListRequest(com.zimbra.soap.account.message.GetDistributionListRequest) SoapTransport(com.zimbra.common.soap.SoapTransport) Test(org.junit.Test)

Example 7 with GetDistributionListRequest

use of com.zimbra.soap.account.message.GetDistributionListRequest in project zm-mailbox by Zimbra.

the class TestDelegatedDL method getDistributionList.

@Test
public void getDistributionList() throws Exception {
    SoapTransport transport = authUser(USER_OWNER);
    GetDistributionListRequest req = new GetDistributionListRequest(DistributionListSelector.fromName(DL_NAME), Boolean.TRUE);
    GetDistributionListResponse resp = invokeJaxb(transport, req);
    DistributionListInfo dlInfo = resp.getDl();
    assertTrue(dlInfo.isOwner());
    assertFalse(dlInfo.isMember());
    String dlId = dlInfo.getId();
    Group group = prov.getGroup(Key.DistributionListBy.name, DL_NAME);
    assertNotNull(group);
    assertEquals(group.getId(), dlId);
    boolean seenMail = false;
    boolean seenSubsPolicy = false;
    boolean seenUnsubsPolicy = false;
    List<? extends KeyValuePair> attrs = dlInfo.getAttrList();
    for (KeyValuePair attr : attrs) {
        String name = attr.getKey();
        String value = attr.getValue();
        if (Provisioning.A_mail.equals(name)) {
            assertEquals(group.getName(), value);
            seenMail = true;
        }
        if (Provisioning.A_zimbraDistributionListSubscriptionPolicy.equals(name)) {
            assertEquals(ZAttrProvisioning.DistributionListSubscriptionPolicy.ACCEPT.name(), value);
            seenSubsPolicy = true;
        }
        // zimbraAccount:GetDistributionListResponse should return the default value, instead of empty.
        if (Provisioning.A_zimbraDistributionListUnsubscriptionPolicy.equals(name)) {
            assertEquals(ZAttrProvisioning.DistributionListUnsubscriptionPolicy.REJECT.name(), value);
            seenUnsubsPolicy = true;
        }
    }
    assertTrue(seenMail);
    assertTrue(seenSubsPolicy);
    assertTrue(seenUnsubsPolicy);
    List<? extends DistributionListGranteeInfoInterface> dlOwners = dlInfo.getOwners();
    assertEquals(1, dlOwners.size());
    for (DistributionListGranteeInfoInterface owner : dlOwners) {
        com.zimbra.soap.type.GranteeType type = owner.getType();
        String id = owner.getId();
        String name = owner.getName();
        assertEquals(com.zimbra.soap.type.GranteeType.usr, type);
        assertEquals(USER_OWNER, name);
    }
}
Also used : GetDistributionListResponse(com.zimbra.soap.account.message.GetDistributionListResponse) Group(com.zimbra.cs.account.Group) DistributionListGranteeInfoInterface(com.zimbra.soap.base.DistributionListGranteeInfoInterface) DistributionListInfo(com.zimbra.soap.account.type.DistributionListInfo) KeyValuePair(com.zimbra.soap.type.KeyValuePair) GetDistributionListRequest(com.zimbra.soap.account.message.GetDistributionListRequest) SoapTransport(com.zimbra.common.soap.SoapTransport) Test(org.junit.Test)

Aggregations

SoapTransport (com.zimbra.common.soap.SoapTransport)7 Group (com.zimbra.cs.account.Group)7 GetDistributionListRequest (com.zimbra.soap.account.message.GetDistributionListRequest)7 Test (org.junit.Test)7 GetDistributionListResponse (com.zimbra.soap.account.message.GetDistributionListResponse)6 DistributionListInfo (com.zimbra.soap.account.type.DistributionListInfo)6 DistributionListActionRequest (com.zimbra.soap.account.message.DistributionListActionRequest)5 DistributionListAction (com.zimbra.soap.account.type.DistributionListAction)5 Account (com.zimbra.cs.account.Account)4 DistributionListActionResponse (com.zimbra.soap.account.message.DistributionListActionResponse)4 DistributionListGranteeSelector (com.zimbra.soap.account.type.DistributionListGranteeSelector)4 DistributionListGranteeInfoInterface (com.zimbra.soap.base.DistributionListGranteeInfoInterface)4 ServiceException (com.zimbra.common.service.ServiceException)2 AccountServiceException (com.zimbra.cs.account.AccountServiceException)2 Bug (com.zimbra.qa.QA.Bug)2 SubscribeDistributionListRequest (com.zimbra.soap.account.message.SubscribeDistributionListRequest)1 DistributionListGranteeInfo (com.zimbra.soap.account.type.DistributionListGranteeInfo)1 DistributionListRightInfo (com.zimbra.soap.account.type.DistributionListRightInfo)1 DistributionListRightSpec (com.zimbra.soap.account.type.DistributionListRightSpec)1 KeyValuePair (com.zimbra.soap.type.KeyValuePair)1