Search in sources :

Example 6 with Bug

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

the class TestLdapProvCos method bug67716.

@Test
@Bug(bug = 67716)
public void bug67716() throws Exception {
    // case does match the case declared in zimbra-attrs.xml
    String ATTR_REAL_ANME = Provisioning.A_zimbraMailQuota;
    String ATTR_LOWERCASE_NAME = ATTR_REAL_ANME.toLowerCase();
    String ATTR_VALUE = "12345";
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(ATTR_LOWERCASE_NAME, ATTR_VALUE);
    Cos cos = createCos(genCosName(), attrs);
    assertEquals(ATTR_VALUE, cos.getAttr(ATTR_REAL_ANME));
    assertEquals(ATTR_VALUE, cos.getAttr(ATTR_LOWERCASE_NAME));
}
Also used : Cos(com.zimbra.cs.account.Cos) Bug(com.zimbra.qa.QA.Bug)

Example 7 with Bug

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

the class TestLdapProvSearchDirectory method filterWithCharsNeedEscaping.

/*
     * RFC 2254
     *
       If a value should contain any of the following characters

               Character       ASCII value
               ---------------------------
               *               0x2a
               (               0x28
               )               0x29
               \               0x5c
               NUL             0x00

       For example, the filter checking whether the "cn" attribute contained
       a value with the character "*" anywhere in it would be represented as
       "(cn=*\2a*)".
     */
@Test
@Bug(bug = 68965)
public void filterWithCharsNeedEscaping() throws Exception {
    Domain subDomain = provUtil.createDomain(genDomainName(baseDomainName()));
    String ATTR = Provisioning.A_displayName;
    Account acctStar = provUtil.createAccount(genAcctNameLocalPart("star"), subDomain, Collections.singletonMap(ATTR, (Object) "*"));
    Account acctLeftParen = provUtil.createAccount(genAcctNameLocalPart("left-paren"), subDomain, Collections.singletonMap(ATTR, (Object) "("));
    Account acctRightParen = provUtil.createAccount(genAcctNameLocalPart("right-paren"), subDomain, Collections.singletonMap(ATTR, (Object) ")"));
    Account acctBackSlash = provUtil.createAccount(genAcctNameLocalPart("back-slash"), subDomain, Collections.singletonMap(ATTR, (Object) "\\"));
    testFilterWithCharsNeedEscaping(acctStar, ATTR, "*\\2a*");
    testFilterWithCharsNeedEscaping(acctLeftParen, ATTR, "*\\28*");
    testFilterWithCharsNeedEscaping(acctRightParen, ATTR, "*\\29*");
    testFilterWithCharsNeedEscaping(acctBackSlash, ATTR, "*\\5c*");
    /*
         * TODO
         *
        testFilterWithCharsNeedEscaping(acctStar, ATTR, "***");
        testFilterWithCharsNeedEscaping(acctStar, ATTR, "*(*");
        testFilterWithCharsNeedEscaping(acctStar, ATTR, "*)*");
        testFilterWithCharsNeedEscaping(acctStar, ATTR, "*\\*");
         */
    deleteAccount(acctStar);
    deleteAccount(acctLeftParen);
    deleteAccount(acctRightParen);
    deleteAccount(acctBackSlash);
    deleteDomain(subDomain);
}
Also used : Account(com.zimbra.cs.account.Account) Domain(com.zimbra.cs.account.Domain) LdapDomain(com.zimbra.cs.account.ldap.entry.LdapDomain) ProvTest(com.zimbra.qa.unittest.prov.ProvTest) Bug(com.zimbra.qa.QA.Bug)

Example 8 with Bug

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

the class TestLdapProvSearchDirectory method filterWithTrailingDot.

@Test
@Bug(bug = 68964)
public void filterWithTrailingDot() throws Exception {
    Domain subDomain = provUtil.createDomain(genDomainName(baseDomainName()));
    Account acct = provUtil.createAccount(genAcctNameLocalPart(), subDomain);
    SearchDirectoryOptions options = new SearchDirectoryOptions();
    options.setDomain(subDomain);
    options.setTypes(SearchDirectoryOptions.ObjectType.accounts);
    options.setFilterString(FilterId.UNITTEST, "(zimbraMailDeliveryAddress=*.*)");
    options.setReturnAttrs(new String[] { Provisioning.A_zimbraMailDeliveryAddress });
    options.setConvertIDNToAscii(true);
    List<NamedEntry> entries = prov.searchDirectory(options);
    Verify.verifyEquals(Lists.newArrayList(acct), entries, true);
    deleteAccount(acct);
    deleteDomain(subDomain);
}
Also used : Account(com.zimbra.cs.account.Account) SearchDirectoryOptions(com.zimbra.cs.account.SearchDirectoryOptions) NamedEntry(com.zimbra.cs.account.NamedEntry) Domain(com.zimbra.cs.account.Domain) LdapDomain(com.zimbra.cs.account.ldap.entry.LdapDomain) ProvTest(com.zimbra.qa.unittest.prov.ProvTest) Bug(com.zimbra.qa.QA.Bug)

Example 9 with Bug

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

the class TestLdapProvSearchDirectory method wildcardFilter.

@Test
@Bug(bug = 67379)
public void wildcardFilter() throws Exception {
    Account acct1 = createAccount(genAcctNameLocalPart("1"));
    Account acct2 = createAccount(genAcctNameLocalPart("2"));
    Account acct3 = createAccount(genAcctNameLocalPart("3"));
    SearchDirectoryOptions options = new SearchDirectoryOptions(domain);
    options.setTypes(ObjectType.accounts);
    options.setSortOpt(SortOpt.SORT_ASCENDING);
    options.setFilterString(FilterId.UNITTEST, "(cn=*)");
    options.setConvertIDNToAscii(true);
    List<NamedEntry> entries = prov.searchDirectory(options);
    Verify.verifyEquals(Lists.newArrayList(acct1, acct2, acct3), entries, true);
    deleteAccount(acct1);
    deleteAccount(acct2);
    deleteAccount(acct3);
}
Also used : Account(com.zimbra.cs.account.Account) SearchDirectoryOptions(com.zimbra.cs.account.SearchDirectoryOptions) NamedEntry(com.zimbra.cs.account.NamedEntry) ProvTest(com.zimbra.qa.unittest.prov.ProvTest) Bug(com.zimbra.qa.QA.Bug)

Example 10 with Bug

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

the class TestACLEffectiveRights method bug70206.

@Bug(bug = 70206)
@Test
public void bug70206() throws Exception {
    Account acct = provUtil.createDelegatedAdmin(genAcctNameLocalPart(), domain);
    Group group = provUtil.createGroup(genGroupNameLocalPart(), domain, false);
    Account grantingAccount = globalAdmin;
    String presetRightUnderTest = Right.RT_deleteDistributionList;
    String attrUnderTest = Provisioning.A_zimbraHideInGal;
    String attrRightUnderTest = InlineAttrRight.composeSetRight(TargetType.dl, attrUnderTest);
    // grant a combo right on global level
    RightCommand.grantRight(prov, grantingAccount, TargetType.global.getCode(), null, null, GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, Right.RT_adminConsoleDLRights, null);
    // deny a preset right (in the combo right) on global level
    RightCommand.grantRight(prov, grantingAccount, TargetType.global.getCode(), null, null, GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, presetRightUnderTest, RightModifier.RM_DENY);
    // grant the preset right on the target
    RightCommand.grantRight(prov, grantingAccount, TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, attrRightUnderTest, null);
    // deny an attr right (in the combo right) on global level
    RightCommand.grantRight(prov, grantingAccount, TargetType.global.getCode(), null, null, GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, attrRightUnderTest, RightModifier.RM_DENY);
    // grant the attr right on the target
    RightCommand.grantRight(prov, grantingAccount, TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, presetRightUnderTest, null);
    EffectiveRights effRights = RightCommand.getEffectiveRights(prov, TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeBy.name, acct.getName(), false, false);
    List<String> presetRights = effRights.presetRights();
    SortedMap<String, EffectiveAttr> setAttrRights = effRights.canSetAttrs();
    /*
        for (String right : presetRights) {
            System.out.println(right);
        }
        */
    assertTrue(presetRights.contains(Right.RT_deleteDistributionList));
    assertTrue(setAttrRights.containsKey(attrUnderTest));
}
Also used : Account(com.zimbra.cs.account.Account) Group(com.zimbra.cs.account.Group) EffectiveAttr(com.zimbra.cs.account.accesscontrol.RightCommand.EffectiveAttr) EffectiveRights(com.zimbra.cs.account.accesscontrol.RightCommand.EffectiveRights) AllEffectiveRights(com.zimbra.cs.account.accesscontrol.RightCommand.AllEffectiveRights) Bug(com.zimbra.qa.QA.Bug) Test(org.junit.Test)

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