Search in sources :

Example 31 with CalendarResource

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;
}
Also used : CalendarResource(com.zimbra.cs.account.CalendarResource)

Example 32 with CalendarResource

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);
}
Also used : Account(com.zimbra.cs.account.Account) CalendarResource(com.zimbra.cs.account.CalendarResource) Test(org.junit.Test)

Example 33 with CalendarResource

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);
}
Also used : Account(com.zimbra.cs.account.Account) CalendarResource(com.zimbra.cs.account.CalendarResource) Test(org.junit.Test)

Example 34 with CalendarResource

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;
}
Also used : HashMap(java.util.HashMap) CalendarResource(com.zimbra.cs.account.CalendarResource)

Example 35 with CalendarResource

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);
}
Also used : Account(com.zimbra.cs.account.Account) NamedEntry(com.zimbra.cs.account.NamedEntry) Server(com.zimbra.cs.account.Server) CalendarResource(com.zimbra.cs.account.CalendarResource) ProvTest(com.zimbra.qa.unittest.prov.ProvTest)

Aggregations

CalendarResource (com.zimbra.cs.account.CalendarResource)40 Account (com.zimbra.cs.account.Account)23 Element (com.zimbra.common.soap.Element)12 Provisioning (com.zimbra.cs.account.Provisioning)11 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)11 Test (org.junit.Test)8 ProvTest (com.zimbra.qa.unittest.prov.ProvTest)7 NamedEntry (com.zimbra.cs.account.NamedEntry)6 ArrayList (java.util.ArrayList)6 ServiceException (com.zimbra.common.service.ServiceException)5 Server (com.zimbra.cs.account.Server)4 Mailbox (com.zimbra.cs.mailbox.Mailbox)4 Invite (com.zimbra.cs.mailbox.calendar.Invite)4 RecurId (com.zimbra.cs.mailbox.calendar.RecurId)4 ZAttendee (com.zimbra.cs.mailbox.calendar.ZAttendee)4 HashMap (java.util.HashMap)4 ICalTimeZone (com.zimbra.common.calendar.ICalTimeZone)3 ParsedDateTime (com.zimbra.common.calendar.ParsedDateTime)3 JavaMailInternetAddress (com.zimbra.common.mime.shim.JavaMailInternetAddress)3 SoapTransport (com.zimbra.common.soap.SoapTransport)3