Search in sources :

Example 11 with Bug

use of com.zimbra.qa.QA.Bug in project zm-mailbox by Zimbra.

the class TestDelegatedDL method noHomeServerZimbraAdmin.

/*
     * Verify groups without a home server will get executed for zimbraAdmin
     * SOAP calls.
     */
@Test
@Bug(bug = 66412)
public void noHomeServerZimbraAdmin() throws Exception {
    String groupName = TestUtil.getAddress(genGroupNameLocalPart(), DOMAIN_NAME);
    Group group = provUtil.createGroup(groupName, DYNAMIC);
    String groupId = group.getId();
    // remove zimbraMailHost
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraMailHost, null);
    prov.modifyAttrs(group, attrs);
    SoapTransport transport = authAdmin(ADMIN);
    Object req;
    com.zimbra.soap.admin.type.DistributionListInfo dlInfo;
    /*
         * GetDistributionList
         */
    req = new com.zimbra.soap.admin.message.GetDistributionListRequest(com.zimbra.soap.admin.type.DistributionListSelector.fromName(groupName));
    com.zimbra.soap.admin.message.GetDistributionListResponse getDLResp = invokeJaxb(transport, req);
    dlInfo = getDLResp.getDl();
    assertEquals(groupId, dlInfo.getId());
    /*
         * ModifyDistributionList
         */
    req = new ModifyDistributionListRequest(groupId);
    ModifyDistributionListResponse modifyDLResp = invokeJaxb(transport, req);
    dlInfo = modifyDLResp.getDl();
    assertEquals(groupId, dlInfo.getId());
    /*
         * AddDistributionAlias
         */
    req = new AddDistributionListAliasRequest(groupId, TestUtil.getAddress(genGroupNameLocalPart("alias"), DOMAIN_NAME));
    AddDistributionListAliasResponse addDLAliasResp = invokeJaxb(transport, req);
    /*
         * RemoveDistributionAlias
         */
    req = new RemoveDistributionListAliasRequest(groupId, TestUtil.getAddress(genGroupNameLocalPart("alias"), DOMAIN_NAME));
    RemoveDistributionListAliasResponse removeDLAliasResp = invokeJaxb(transport, req);
    /*
         * AddDistributionListMember
         */
    req = new AddDistributionListMemberRequest(groupId, Collections.singleton(TestUtil.getAddress(genAcctNameLocalPart("member"), DOMAIN_NAME)));
    AddDistributionListMemberResponse addDLMemberResp = invokeJaxb(transport, req);
    /*
         * RemoveDistributionListMember
         */
    req = new RemoveDistributionListMemberRequest(groupId, Collections.singleton(TestUtil.getAddress(genAcctNameLocalPart("member"), DOMAIN_NAME)));
    RemoveDistributionListMemberResponse removeDLMemberResp = invokeJaxb(transport, req);
    /*
         * DeleteDistributionList
         */
    req = new DeleteDistributionListRequest(groupId);
    DeleteDistributionListResponse deleteDLResp = invokeJaxb(transport, req);
}
Also used : Group(com.zimbra.cs.account.Group) RemoveDistributionListAliasRequest(com.zimbra.soap.admin.message.RemoveDistributionListAliasRequest) AddDistributionListMemberRequest(com.zimbra.soap.admin.message.AddDistributionListMemberRequest) AddDistributionListAliasRequest(com.zimbra.soap.admin.message.AddDistributionListAliasRequest) RemoveDistributionListMemberResponse(com.zimbra.soap.admin.message.RemoveDistributionListMemberResponse) RemoveDistributionListAliasResponse(com.zimbra.soap.admin.message.RemoveDistributionListAliasResponse) RemoveDistributionListMemberRequest(com.zimbra.soap.admin.message.RemoveDistributionListMemberRequest) AddDistributionListMemberResponse(com.zimbra.soap.admin.message.AddDistributionListMemberResponse) ModifyDistributionListRequest(com.zimbra.soap.admin.message.ModifyDistributionListRequest) DeleteDistributionListRequest(com.zimbra.soap.admin.message.DeleteDistributionListRequest) DeleteDistributionListResponse(com.zimbra.soap.admin.message.DeleteDistributionListResponse) AddDistributionListAliasResponse(com.zimbra.soap.admin.message.AddDistributionListAliasResponse) SoapTransport(com.zimbra.common.soap.SoapTransport) ModifyDistributionListResponse(com.zimbra.soap.admin.message.ModifyDistributionListResponse) Test(org.junit.Test) Bug(com.zimbra.qa.QA.Bug)

Example 12 with Bug

use of com.zimbra.qa.QA.Bug in project zm-mailbox by Zimbra.

the class TestDelegatedDL method noHomeServerZimbraAccount.

/*
     * Verify groups without a home server will get PROXY_ERROR for zimbraAccount
     * SOAP calls.
     */
@Test
@Bug(bug = 66412)
public void noHomeServerZimbraAccount() throws Exception {
    String groupName = TestUtil.getAddress(genGroupNameLocalPart(), DOMAIN_NAME);
    Group group = provUtil.createGroup(groupName, DYNAMIC);
    // remove zimbraMailHost
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraMailHost, null);
    prov.modifyAttrs(group, attrs);
    SoapTransport transport = authUser(USER_OWNER);
    /*
         * GetDistributionList
         */
    GetDistributionListRequest getDLreq = new GetDistributionListRequest(DistributionListSelector.fromName(groupName), Boolean.TRUE);
    verifyCaughtProxyError(transport, getDLreq);
    /*
         * DistributionListAction
         */
    DistributionListActionRequest DLActionReq = new DistributionListActionRequest(DistributionListSelector.fromName(groupName), new DistributionListAction(Operation.addMembers));
    verifyCaughtProxyError(transport, DLActionReq);
    /*
         * SubscribeDistributionList
         */
    SubscribeDistributionListRequest subsDLReq = new SubscribeDistributionListRequest(DistributionListSelector.fromName(groupName), DistributionListSubscribeOp.subscribe);
    verifyCaughtProxyError(transport, subsDLReq);
    provUtil.deleteGroup(group);
}
Also used : Group(com.zimbra.cs.account.Group) SubscribeDistributionListRequest(com.zimbra.soap.account.message.SubscribeDistributionListRequest) DistributionListAction(com.zimbra.soap.account.type.DistributionListAction) GetDistributionListRequest(com.zimbra.soap.account.message.GetDistributionListRequest) SoapTransport(com.zimbra.common.soap.SoapTransport) DistributionListActionRequest(com.zimbra.soap.account.message.DistributionListActionRequest) Test(org.junit.Test) Bug(com.zimbra.qa.QA.Bug)

Example 13 with Bug

use of com.zimbra.qa.QA.Bug in project zm-mailbox by Zimbra.

the class TestDelegatedDL method hideInGal.

@Test
@Bug(bug = 66234)
public void hideInGal() throws Exception {
    // setup GAL sync account
    GalTestUtil.enableGalSyncAccount(prov, domain.getName());
    String GROUP_NAME = getAddress(genGroupNameLocalPart("group"));
    Multimap<String, String> attrs = ArrayListMultimap.create();
    attrs.put(Provisioning.A_zimbraHideInGal, ProvisioningConstants.TRUE);
    // create an owner account
    Account ownerAcct = provUtil.createAccount(genAcctNameLocalPart("owner"), domain);
    Group group = createGroupAndAddOwner(GROUP_NAME, attrs, ownerAcct.getName());
    // create member accounts and add it to the group
    Account memberAcct1 = provUtil.createAccount(genAcctNameLocalPart("member1"), domain);
    Account memberAcct2 = provUtil.createAccount(genAcctNameLocalPart("member2"), domain);
    Account memberAcct3 = provUtil.createAccount(genAcctNameLocalPart("member3"), domain);
    prov.addGroupMembers(group, new String[] { memberAcct3.getName(), memberAcct2.getName(), memberAcct1.getName() });
    // create a non-member account
    Account nonMemberAcct = provUtil.createAccount(genAcctNameLocalPart("non-member"), domain);
    /*
         * Owners should be able to see members even when the list is hideInGal
         */
    // auth as the owner
    SoapTransport transport = authUser(ownerAcct.getName());
    GetDistributionListMembersRequest req = new GetDistributionListMembersRequest(null, null, group.getName());
    GetDistributionListMembersResponse resp = invokeJaxb(transport, req);
    List<String> members = resp.getDlMembers();
    //make sure members are returned sorted
    Verify.verifyEquals(Lists.newArrayList(memberAcct1.getName(), memberAcct2.getName(), memberAcct3.getName()), members);
    // add another member, verify cache is updated
    Account memberAcct4 = provUtil.createAccount(genAcctNameLocalPart("member4"), domain);
    prov.addGroupMembers(group, new String[] { memberAcct4.getName() });
    resp = invokeJaxb(transport, req);
    members = resp.getDlMembers();
    Verify.verifyEquals(Lists.newArrayList(memberAcct1.getName(), memberAcct2.getName(), memberAcct3.getName(), memberAcct4.getName()), members);
    String errorCode = null;
    /*
         * non owner cannot see members when the list is hideInGal
         */
    transport = authUser(memberAcct1.getName());
    errorCode = null;
    try {
        invokeJaxb(transport, req);
    } catch (ServiceException e) {
        errorCode = e.getCode();
    }
    assertEquals(AccountServiceException.NO_SUCH_DISTRIBUTION_LIST, errorCode);
    /*
         * non owner cannot see members when the list is hideInGal
         */
    transport = authUser(nonMemberAcct.getName());
    errorCode = null;
    try {
        invokeJaxb(transport, req);
    } catch (ServiceException e) {
        errorCode = e.getCode();
    }
    assertEquals(AccountServiceException.NO_SUCH_DISTRIBUTION_LIST, errorCode);
    GalTestUtil.disableGalSyncAccount(prov, domain.getName());
    provUtil.deleteAccount(ownerAcct);
    provUtil.deleteAccount(memberAcct1);
    provUtil.deleteAccount(memberAcct2);
    provUtil.deleteAccount(memberAcct3);
    provUtil.deleteAccount(memberAcct4);
    provUtil.deleteAccount(nonMemberAcct);
    provUtil.deleteGroup(group);
}
Also used : Account(com.zimbra.cs.account.Account) Group(com.zimbra.cs.account.Group) GetDistributionListMembersResponse(com.zimbra.soap.account.message.GetDistributionListMembersResponse) AccountServiceException(com.zimbra.cs.account.AccountServiceException) ServiceException(com.zimbra.common.service.ServiceException) GetDistributionListMembersRequest(com.zimbra.soap.account.message.GetDistributionListMembersRequest) SoapTransport(com.zimbra.common.soap.SoapTransport) Test(org.junit.Test) Bug(com.zimbra.qa.QA.Bug)

Example 14 with Bug

use of com.zimbra.qa.QA.Bug in project zm-mailbox by Zimbra.

the class TestDelegatedDL method InvalidOwnerEmail.

@Test
@Bug(bug = 72791)
public void InvalidOwnerEmail() throws Exception {
    String GROUP_NAME = getAddress(genGroupNameLocalPart());
    String errorCode = null;
    try {
        Group group = createGroupAndAddOwner(GROUP_NAME, "bogus@bogus.com");
    } catch (ServiceException e) {
        errorCode = e.getCode();
    }
    assertEquals(AccountServiceException.NO_SUCH_ACCOUNT, errorCode);
}
Also used : Group(com.zimbra.cs.account.Group) AccountServiceException(com.zimbra.cs.account.AccountServiceException) ServiceException(com.zimbra.common.service.ServiceException) Test(org.junit.Test) Bug(com.zimbra.qa.QA.Bug)

Example 15 with Bug

use of com.zimbra.qa.QA.Bug in project zm-mailbox by Zimbra.

the class TestAutoProvision method errorHandling.

@Test
@Bug(bug = 70720)
public void errorHandling() throws Exception {
    /*
         * create and setup zimbra domain
         */
    Map<String, Object> domainAttrs = Maps.newHashMap();
    domainAttrs.put(Provisioning.A_zimbraAutoProvLdapURL, "ldap://localhost:389");
    domainAttrs.put(Provisioning.A_zimbraAutoProvLdapAdminBindDn, extDomainAdminBindDn);
    domainAttrs.put(Provisioning.A_zimbraAutoProvLdapAdminBindPassword, extDomainAdminBindPassword);
    StringUtil.addToMultiMap(domainAttrs, Provisioning.A_zimbraAutoProvMode, AutoProvMode.LAZY.name());
    StringUtil.addToMultiMap(domainAttrs, Provisioning.A_zimbraAutoProvMode, AutoProvMode.MANUAL.name());
    domainAttrs.put(Provisioning.A_zimbraAutoProvLdapSearchFilter, "(cn=auth*)");
    // domainAttrs.put(Provisioning.A_zimbraAutoProvLdapSearchFilter, "(cn=%n)");
    domainAttrs.put(Provisioning.A_zimbraAutoProvLdapSearchBase, extDomainDn);
    domainAttrs.put(Provisioning.A_zimbraAutoProvAccountNameMap, "cn");
    domainAttrs.put(Provisioning.A_zimbraAutoProvAttrMap, "userPassword=userPassword");
    Domain domain = createZimbraDomain(genDomainSegmentName(), domainAttrs);
    /*
         * create external accounts
         */
    Map<String, Object> extAcct1Attrs = Maps.newHashMap();
    extAcct1Attrs.put("cn", "authaccount01");
    createExternalAcctEntry("acct1", "test123", extAcct1Attrs);
    Map<String, Object> extAcct2Attrs = Maps.newHashMap();
    extAcct2Attrs.put("cn", "authaccount02");
    createExternalAcctEntry("acct2", "test123", extAcct2Attrs);
    Map<String, Object> extAcct3Attrs = Maps.newHashMap();
    extAcct3Attrs.put("cn", "authaccount03");
    createExternalAcctEntry("acct3", "test123", extAcct3Attrs);
    Map<String, Object> extAcct4Attrs = Maps.newHashMap();
    extAcct4Attrs.put("cn", "authaccount04");
    createExternalAcctEntry("acct4", "test123", extAcct4Attrs);
    /*
         * do a manual auto provision
         */
    SoapTransport transport = authZimbraAdmin();
    DomainSelector domainSel = new DomainSelector(DomainSelector.DomainBy.name, domain.getName());
    PrincipalSelector principalSel = PrincipalSelector.create(AutoProvPrincipalBy.name, "authaccount04");
    AutoProvAccountRequest req = AutoProvAccountRequest.create(domainSel, principalSel);
    boolean caughtException = false;
    try {
        invokeJaxb(transport, req);
    } catch (ServiceException e) {
        String msg = e.getMessage();
        if (e.getCode().equals(LdapException.MULTIPLE_ENTRIES_MATCHED) && msg.contains(String.format("uid=acct1,ou=people,%s", extDomainDn)) && msg.contains(String.format("uid=acct2,ou=people,%s", extDomainDn)) && msg.contains(String.format("uid=acct3,ou=people,%s", extDomainDn)) && msg.contains(String.format("uid=acct4,ou=people,%s", extDomainDn))) {
            caughtException = true;
        }
    }
    assertTrue(caughtException);
    /*
         * modify domain to have the correct search filter
         */
    domain.setAutoProvLdapSearchFilter("(cn=%n)");
    /*
         * do the manual provision, should succeed this time
         */
    AutoProvAccountResponse resp = invokeJaxb(transport, req);
    AccountInfo acctInfo = resp.getAccount();
    assertEquals(TestUtil.getAddress("authaccount04", domain.getName()), acctInfo.getName());
    /*
         * do the same manual provision again, should fail with 
         */
    caughtException = false;
    try {
        invokeJaxb(transport, req);
    } catch (ServiceException e) {
        String msg = e.getMessage();
        if (e.getCode().equals(AccountServiceException.ACCOUNT_EXISTS)) {
            caughtException = true;
        }
    }
    assertTrue(caughtException);
/*
        <CreateDomainRequest xmlns="urn:zimbraAdmin">
            <name>autoprov44.1330496906457.com</name>
            <a n="zimbraAutoProvLdapURL">ldap://zqa-003.eng.vmware.com:389/</a>
            <a n="zimbraAutoProvLdapAdminBindDn">administrator@zimbraqa.com</a>
            <a n="zimbraAutoProvLdapAdminBindPassword">liquidsys</a>
            <a n="zimbraAutoProvMode">LAZY</a>
            <a n="zimbraAutoProvMode">MANUAL</a>
            <a n="zimbraAutoProvLdapSearchFilter">(cn=auth*)</a>
            <a n="zimbraAutoProvLdapSearchBase">OU=CommonUsers,DC=zimbraqa,DC=com</a>
            <a n="zimbraAutoProvAccountNameMap">cn</a>
            <a n="zimbraAutoProvAttrMap">userPassword=userPassword</a>
        </CreateDomainRequest>
        
        zmsoap  -z AutoProvAccountRequest domain=bug70720.com.zimbra.qa.unittest.prov.soap.testautoprovision.soaptest.unittest @by=name ../principal=authaccount04 @by=name          
        
        this zmsoap yields the following soap:
        
        <AutoProvAccountRequest xmlns="urn:zimbraAdmin">
            <domain by="name">bug70720.com.zimbra.qa.unittest.prov.soap.testautoprovision.soaptest.unittest</domain>
            <principal by="name">authaccount04</principal>
        </AutoProvAccountRequest>
        */
}
Also used : PrincipalSelector(com.zimbra.soap.admin.type.PrincipalSelector) AccountServiceException(com.zimbra.cs.account.AccountServiceException) ServiceException(com.zimbra.common.service.ServiceException) DomainSelector(com.zimbra.soap.admin.type.DomainSelector) AutoProvAccountResponse(com.zimbra.soap.admin.message.AutoProvAccountResponse) AutoProvAccountRequest(com.zimbra.soap.admin.message.AutoProvAccountRequest) Domain(com.zimbra.cs.account.Domain) SoapTransport(com.zimbra.common.soap.SoapTransport) AccountInfo(com.zimbra.soap.admin.type.AccountInfo) Test(org.junit.Test) Bug(com.zimbra.qa.QA.Bug)

Aggregations

Bug (com.zimbra.qa.QA.Bug)20 Account (com.zimbra.cs.account.Account)12 Test (org.junit.Test)12 SoapTransport (com.zimbra.common.soap.SoapTransport)9 Group (com.zimbra.cs.account.Group)8 ServiceException (com.zimbra.common.service.ServiceException)6 AccountServiceException (com.zimbra.cs.account.AccountServiceException)6 Domain (com.zimbra.cs.account.Domain)6 ProvTest (com.zimbra.qa.unittest.prov.ProvTest)3 DistributionList (com.zimbra.cs.account.DistributionList)2 NamedEntry (com.zimbra.cs.account.NamedEntry)2 SearchDirectoryOptions (com.zimbra.cs.account.SearchDirectoryOptions)2 LdapDomain (com.zimbra.cs.account.ldap.entry.LdapDomain)2 DistributionListActionRequest (com.zimbra.soap.account.message.DistributionListActionRequest)2 GetDistributionListMembersRequest (com.zimbra.soap.account.message.GetDistributionListMembersRequest)2 GetDistributionListMembersResponse (com.zimbra.soap.account.message.GetDistributionListMembersResponse)2 GetDistributionListRequest (com.zimbra.soap.account.message.GetDistributionListRequest)2 DistributionListAction (com.zimbra.soap.account.type.DistributionListAction)2 ArrayList (java.util.ArrayList)2 ZAce (com.zimbra.client.ZAce)1