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));
}
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);
}
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);
}
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);
}
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));
}
Aggregations