use of com.zimbra.cs.account.CalendarResource in project zm-mailbox by Zimbra.
the class TestSetPassword method createCRAndSetPasswordpolicy.
private CalendarResource createCRAndSetPasswordpolicy() throws Exception {
CalendarResource cr = provUtil.createCalendarResource(genCalendarResourceNameLocalPart(), domain);
setPasswordPolicy(cr);
return cr;
}
use of com.zimbra.cs.account.CalendarResource in project zm-mailbox by Zimbra.
the class TestSetPassword method delegatedAdminWithChangePasswordRight.
@Test
public void delegatedAdminWithChangePasswordRight() throws Exception {
Account acct = createAcctAndSetPasswordpolicy();
CalendarResource cr = createCRAndSetPasswordpolicy();
Account adminAcct = provUtil.createDelegatedAdmin(genAcctNameLocalPart("admin"), domain);
prov.grantRight(TargetType.account.getCode(), TargetBy.name, acct.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, adminAcct.getName(), null, Right.RT_changeAccountPassword, null);
prov.grantRight(TargetType.calresource.getCode(), TargetBy.name, cr.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, adminAcct.getName(), null, Right.RT_changeCalendarResourcePassword, null);
verifyInvalidPassword(adminAcct, acct, true);
verifyOK(adminAcct, acct, false);
verifyInvalidPassword(adminAcct, cr, true);
verifyOK(adminAcct, cr, false);
provUtil.deleteAccount(acct);
provUtil.deleteAccount(cr);
provUtil.deleteAccount(adminAcct);
}
use of com.zimbra.cs.account.CalendarResource in project zm-mailbox by Zimbra.
the class TestSetPassword method delegatedAdminWithNoRight.
@Test
public void delegatedAdminWithNoRight() throws Exception {
Account acct = createAcctAndSetPasswordpolicy();
CalendarResource cr = createCRAndSetPasswordpolicy();
Account adminAcct = provUtil.createDelegatedAdmin(genAcctNameLocalPart("admin"), domain);
verifyPermDenied(adminAcct, acct, true);
verifyPermDenied(adminAcct, acct, false);
verifyPermDenied(adminAcct, cr, true);
verifyPermDenied(adminAcct, cr, false);
provUtil.deleteAccount(acct);
provUtil.deleteAccount(cr);
provUtil.deleteAccount(adminAcct);
}
use of com.zimbra.cs.account.CalendarResource in project zm-mailbox by Zimbra.
the class TestProv method createCalendarResource.
protected CalendarResource createCalendarResource(String localpart, Domain domain) throws Exception {
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_displayName, localpart);
attrs.put(Provisioning.A_zimbraCalResType, "Equipment");
String email = localpart + "@" + domain.getName();
CalendarResource cr = mProv.createCalendarResource(email, PASSWORD, attrs);
mCreatedEntries.add(cr);
return cr;
}
use of com.zimbra.cs.account.CalendarResource in project zm-mailbox by Zimbra.
the class TestLdapProvSearchDirectory method getAllAccountsByDomainAndServer.
@Test
public void getAllAccountsByDomainAndServer() throws Exception {
Account acct3 = createAccount(genAcctNameLocalPart("3"));
Account acct2 = createAccount(genAcctNameLocalPart("2"));
Account acct1 = createAccount(genAcctNameLocalPart("1"));
CalendarResource cr = createCalendarResource(genAcctNameLocalPart("cr"));
final List<NamedEntry> acctsVisitor = Lists.newArrayList();
NamedEntry.Visitor visitor = new NamedEntry.Visitor() {
@Override
public void visit(NamedEntry entry) throws ServiceException {
acctsVisitor.add(entry);
}
};
Server server = prov.getLocalServer();
prov.getAllAccounts(domain, server, visitor);
Verify.verifyEquals(Lists.newArrayList(acct1, acct2, acct3), acctsVisitor, false);
acctsVisitor.clear();
Server otherServer = createServer(genServerName());
prov.getAllAccounts(domain, otherServer, visitor);
Verify.verifyEquals(null, acctsVisitor, false);
deleteAccount(acct1);
deleteAccount(acct2);
deleteAccount(acct3);
deleteAccount(cr);
}
Aggregations