Search in sources :

Example 1 with LdapCalendarResource

use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.

the class LdapProvisioning method createCalendarResource.

@Override
public CalendarResource createCalendarResource(String emailAddress, String password, Map<String, Object> calResAttrs) throws ServiceException {
    emailAddress = emailAddress.toLowerCase().trim();
    calResAttrs.put(Provisioning.A_zimbraAccountCalendarUserType, AccountCalendarUserType.RESOURCE.toString());
    SpecialAttrs specialAttrs = mDIT.handleSpecialAttrs(calResAttrs);
    CallbackContext callbackContext = new CallbackContext(CallbackContext.Op.CREATE);
    Set<String> ocs = LdapObjectClass.getCalendarResourceObjectClasses(this);
    Account acct = createAccount(emailAddress, password, calResAttrs, specialAttrs, ocs.toArray(new String[0]), false, null);
    LdapCalendarResource resource = (LdapCalendarResource) getCalendarResourceById(acct.getId(), true);
    AttributeManager.getInstance().postModify(calResAttrs, resource, callbackContext);
    return resource;
}
Also used : Account(com.zimbra.cs.account.Account) GuestAccount(com.zimbra.cs.account.GuestAccount) LdapAccount(com.zimbra.cs.account.ldap.entry.LdapAccount) LdapCalendarResource(com.zimbra.cs.account.ldap.entry.LdapCalendarResource) CallbackContext(com.zimbra.cs.account.callback.CallbackContext)

Example 2 with LdapCalendarResource

use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.

the class LdapProvisioning method getCalendarResourceById.

private CalendarResource getCalendarResourceById(String zimbraId, boolean loadFromMaster) throws ServiceException {
    if (zimbraId == null)
        return null;
    Account acct = accountCache.getById(zimbraId);
    if (acct != null) {
        if (acct instanceof LdapCalendarResource) {
            return (LdapCalendarResource) acct;
        } else {
            // could be a non-resource Account
            return null;
        }
    }
    LdapCalendarResource resource = (LdapCalendarResource) getAccountByQuery(mDIT.mailBranchBaseDN(), filterFactory.calendarResourceById(zimbraId), null, loadFromMaster);
    accountCache.put(resource);
    return resource;
}
Also used : Account(com.zimbra.cs.account.Account) GuestAccount(com.zimbra.cs.account.GuestAccount) LdapAccount(com.zimbra.cs.account.ldap.entry.LdapAccount) LdapCalendarResource(com.zimbra.cs.account.ldap.entry.LdapCalendarResource)

Example 3 with LdapCalendarResource

use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.

the class LdapProvisioning method getCalendarResourceByForeignPrincipal.

private CalendarResource getCalendarResourceByForeignPrincipal(String foreignPrincipal, boolean loadFromMaster) throws ServiceException {
    LdapCalendarResource resource = (LdapCalendarResource) getAccountByQuery(mDIT.mailBranchBaseDN(), filterFactory.calendarResourceByForeignPrincipal(foreignPrincipal), null, loadFromMaster);
    accountCache.put(resource);
    return resource;
}
Also used : LdapCalendarResource(com.zimbra.cs.account.ldap.entry.LdapCalendarResource)

Example 4 with LdapCalendarResource

use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.

the class LdapProvisioning method getCalendarResourceByName.

private CalendarResource getCalendarResourceByName(String emailAddress, boolean loadFromMaster) throws ServiceException {
    emailAddress = fixupAccountName(emailAddress);
    Account acct = accountCache.getByName(emailAddress);
    if (acct != null) {
        if (acct instanceof LdapCalendarResource) {
            return (LdapCalendarResource) acct;
        } else {
            // could be a non-resource Account
            return null;
        }
    }
    LdapCalendarResource resource = (LdapCalendarResource) getAccountByQuery(mDIT.mailBranchBaseDN(), filterFactory.calendarResourceByName(emailAddress), null, loadFromMaster);
    accountCache.put(resource);
    return resource;
}
Also used : Account(com.zimbra.cs.account.Account) GuestAccount(com.zimbra.cs.account.GuestAccount) LdapAccount(com.zimbra.cs.account.ldap.entry.LdapAccount) LdapCalendarResource(com.zimbra.cs.account.ldap.entry.LdapCalendarResource)

Example 5 with LdapCalendarResource

use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.

the class LdapProvisioning method makeAccount.

private Account makeAccount(String dn, ZAttributes attrs, MakeObjectOpt makeObjOpt) throws ServiceException {
    String userType = attrs.getAttrString(Provisioning.A_zimbraAccountCalendarUserType);
    boolean isAccount = (userType == null) || userType.equals(AccountCalendarUserType.USER.toString());
    String emailAddress = attrs.getAttrString(Provisioning.A_zimbraMailDeliveryAddress);
    if (emailAddress == null)
        emailAddress = mDIT.dnToEmail(dn, attrs);
    Account acct = (isAccount) ? new LdapAccount(dn, emailAddress, attrs, null, this) : new LdapCalendarResource(dn, emailAddress, attrs, null, this);
    setAccountDefaults(acct, makeObjOpt);
    return acct;
}
Also used : Account(com.zimbra.cs.account.Account) GuestAccount(com.zimbra.cs.account.GuestAccount) LdapAccount(com.zimbra.cs.account.ldap.entry.LdapAccount) LdapCalendarResource(com.zimbra.cs.account.ldap.entry.LdapCalendarResource) LdapAccount(com.zimbra.cs.account.ldap.entry.LdapAccount)

Aggregations

LdapCalendarResource (com.zimbra.cs.account.ldap.entry.LdapCalendarResource)5 Account (com.zimbra.cs.account.Account)4 GuestAccount (com.zimbra.cs.account.GuestAccount)4 LdapAccount (com.zimbra.cs.account.ldap.entry.LdapAccount)4 CallbackContext (com.zimbra.cs.account.callback.CallbackContext)1