use of com.zimbra.cs.account.DistributionList in project zm-mailbox by Zimbra.
the class TestDistListACL method testMilterGuestSendToDL.
/**
* "gst" GranteeType testing.
* Sender must match the configured guest email address. The secret is ignored!
*/
@Test
public void testMilterGuestSendToDL() throws Exception {
DistributionList dl = prov.createDistributionList(listAddress, new HashMap<String, Object>());
String guestName = "fred@example.test";
prov.grantRight("dl", TargetBy.name, listAddress, GranteeType.GT_GUEST.getCode(), GranteeBy.name, guestName, "", /* secret */
RightConsts.RT_sendToDistList, (RightModifier) null);
doCheckSentToDistListGuestRight(dl, guestName, guestName, true);
doCheckSentToDistListGuestRight(dl, "pete@example.test", guestName, false);
// Bug 83252 case shouldn't matter
doCheckSentToDistListGuestRight(dl, "FreD@example.test", guestName, true);
}
use of com.zimbra.cs.account.DistributionList in project zm-mailbox by Zimbra.
the class TestDistListACL method testMilterDomainSendToDL.
/**
* "dom" GranteeType testing.
* Sender must exist and be in the domain that is allowed to send to the DL
*/
@Test
public void testMilterDomainSendToDL() throws Exception {
DistributionList dl = prov.createDistributionList(listAddress, new HashMap<String, Object>());
String user1email = TestUtil.getAddress(USER_NAME);
Account user1account = TestUtil.getAccount(USER_NAME);
prov.grantRight("dl", TargetBy.name, listAddress, GranteeType.GT_DOMAIN.getCode(), GranteeBy.name, user1account.getDomainName(), null, /* secret */
RightConsts.RT_sendToDistList, (RightModifier) null);
doCheckSentToDistListDomRight(dl, user1email, user1account.getDomainName(), true);
doCheckSentToDistListDomRight(dl, "pete@example.test", user1account.getDomainName(), false);
doCheckSentToDistListDomRight(dl, user1email.toUpperCase(Locale.ENGLISH), user1account.getDomainName(), true);
}
use of com.zimbra.cs.account.DistributionList in project zm-mailbox by Zimbra.
the class TestDistListACL method testMilterUserSendToDL.
/**
* "usr" GranteeType testing.
* Sender must match the configured user email address.
*/
@Test
public void testMilterUserSendToDL() throws Exception {
DistributionList dl = prov.createDistributionList(listAddress, new HashMap<String, Object>());
String user1email = TestUtil.getAddress(USER_NAME);
String user2email = TestUtil.getAddress(USER_NAME2);
prov.grantRight("dl", TargetBy.name, listAddress, GranteeType.GT_USER.getCode(), GranteeBy.name, user1email, null, /* secret */
RightConsts.RT_sendToDistList, (RightModifier) null);
doCheckSentToDistListUserRight(dl, user1email, user1email, true);
doCheckSentToDistListUserRight(dl, "pete@example.test", user1email, false);
doCheckSentToDistListUserRight(dl, user2email, user1email, false);
doCheckSentToDistListUserRight(dl, user1email.toUpperCase(Locale.ENGLISH), user1email, true);
}
use of com.zimbra.cs.account.DistributionList in project zm-mailbox by Zimbra.
the class TestLdapProvSearchDirectory method renameDomainSearchAcctCrDl.
@Test
public void renameDomainSearchAcctCrDl() throws Exception {
Account acct = createAccount(genAcctNameLocalPart("acct"));
CalendarResource cr = createCalendarResource(genAcctNameLocalPart("cr"));
DistributionList dl = createDistributionList(genGroupNameLocalPart("dl"));
String domainDN = ((LdapDomain) domain).getDN();
String searchBase = ((LdapProv) prov).getDIT().domainDNToAccountSearchDN(domainDN);
final List<NamedEntry> entries = Lists.newArrayList();
NamedEntry.Visitor visitor = new NamedEntry.Visitor() {
@Override
public void visit(NamedEntry entry) throws ServiceException {
// System.out.println(entry.getName());
entries.add(entry);
}
};
SearchDirectoryOptions options = new SearchDirectoryOptions();
options.setDomain(domain);
options.setOnMaster(true);
options.setFilterString(FilterId.RENAME_DOMAIN, null);
options.setTypes(ObjectType.accounts, ObjectType.resources, ObjectType.distributionlists);
prov.searchDirectory(options, visitor);
Verify.verifyEquals(Lists.newArrayList(acct, cr, dl), entries, false);
/*
// legacy code and ldap trace
int flags = Provisioning.SD_ACCOUNT_FLAG + Provisioning.SD_CALENDAR_RESOURCE_FLAG + Provisioning.SD_DISTRIBUTION_LIST_FLAG;
((LdapProvisioning) prov).searchObjects(null, null, searchBase, flags, visitor, 0);
*
Oct 12 22:10:43 pshao-macbookpro-2 slapd[3065]: conn=1081 op=434 SRCH base="ou=people,dc=com,dc=zimbra,dc=qa,dc=unittest,dc=testldapprovsearchdirectory" scope=2 deref=0 filter="(|(objectClass=zimbraAccount)(objectClass=zimbraDistributionList)(objectClass=zimbraCalendarResource))"
Oct 12 22:10:43 pshao-macbookpro-2 slapd[3065]: conn=1081 op=434 SEARCH RESULT tag=101 err=0 nentries=3 text=
*/
deleteAccount(acct);
deleteAccount(cr);
deleteGroup(dl);
}
use of com.zimbra.cs.account.DistributionList in project zm-mailbox by Zimbra.
the class TestLdapProvSearchDirectory method getAllGroups.
@Test
public void getAllGroups() throws Exception {
DistributionList dl = createDistributionList(genGroupNameLocalPart("dl"));
DynamicGroup dg = createDynamicGroup(genGroupNameLocalPart("dg"));
// create a sub domain
String SUB_DOMAIN_NAME = "sub." + baseDomainName();
Domain subDomain = provUtil.createDomain(SUB_DOMAIN_NAME, null);
// create a DL and a DG in the sub domain
DistributionList dlSub = createDistributionList(genGroupNameLocalPart("dl-sub"), subDomain);
DynamicGroup dgSub = createDynamicGroup(genGroupNameLocalPart("dg-sub"), subDomain);
List<Group> groups = prov.getAllGroups(domain);
Verify.verifyEquals(Lists.newArrayList(dg, dl), groups, true);
deleteGroup(dl);
deleteGroup(dg);
deleteGroup(dlSub);
deleteGroup(dgSub);
}
Aggregations