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 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 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 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 TestDelegatedDL method distributionListActionSetBadOwners.
@Test
@Bug(bug = 72791)
public void distributionListActionSetBadOwners() throws Exception {
String GROUP_NAME = getAddress(genGroupNameLocalPart());
Group group = createGroupAndAddOwner(GROUP_NAME);
Account owner1 = provUtil.createAccount(genAcctNameLocalPart("1"), domain);
Account owner2 = provUtil.createAccount(genAcctNameLocalPart("2"), domain);
Account owner3 = provUtil.createAccount(genAcctNameLocalPart("3"), domain);
SoapTransport transport = authUser(USER_OWNER);
//
// setOwners: some good owners an a bogus owner (not a user)
//
DistributionListAction action = new DistributionListAction(Operation.setOwners);
DistributionListActionRequest req = new DistributionListActionRequest(DistributionListSelector.fromName(GROUP_NAME), action);
action.addOwner(new DistributionListGranteeSelector(com.zimbra.soap.type.GranteeType.usr, DistributionListGranteeBy.name, USER_OWNER));
action.addOwner(new DistributionListGranteeSelector(com.zimbra.soap.type.GranteeType.usr, DistributionListGranteeBy.name, owner1.getName()));
action.addOwner(new DistributionListGranteeSelector(com.zimbra.soap.type.GranteeType.usr, DistributionListGranteeBy.name, owner2.getName()));
action.addOwner(new DistributionListGranteeSelector(com.zimbra.soap.type.GranteeType.usr, DistributionListGranteeBy.name, owner3.getName()));
action.addOwner(new DistributionListGranteeSelector(com.zimbra.soap.type.GranteeType.usr, DistributionListGranteeBy.name, "bogus@bogus.com"));
String errorCode = null;
try {
DistributionListActionResponse resp = invokeJaxb(transport, req);
} catch (ServiceException e) {
errorCode = e.getCode();
}
assertEquals(AccountServiceException.NO_SUCH_ACCOUNT, errorCode);
//
// verify owners are NOT replaced
//
GetDistributionListRequest getDLReq = new GetDistributionListRequest(DistributionListSelector.fromName(GROUP_NAME), Boolean.TRUE);
GetDistributionListResponse getDLResp = invokeJaxb(transport, getDLReq);
DistributionListInfo dlInfo = getDLResp.getDl();
List<? extends DistributionListGranteeInfoInterface> owners = dlInfo.getOwners();
Set<String> ownerNames = Sets.newHashSet();
for (DistributionListGranteeInfoInterface owner : owners) {
if (owner.getType() == com.zimbra.soap.type.GranteeType.usr) {
ownerNames.add(owner.getName());
}
}
assertEquals(1, owners.size());
Verify.verifyEquals(Sets.newHashSet(USER_OWNER), ownerNames);
}
Aggregations