Search in sources :

Example 1 with UCService

use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.

the class SoapProvisioning method getAllUCServices.

@Override
public List<UCService> getAllUCServices() throws ServiceException {
    ArrayList<UCService> result = new ArrayList<UCService>();
    GetAllUCServicesResponse resp = invokeJaxb(new GetAllUCServicesRequest());
    for (UCServiceInfo ucServiceInfo : resp.getUCServiceList()) {
        result.add(new SoapUCService(ucServiceInfo, this));
    }
    return result;
}
Also used : UCService(com.zimbra.cs.account.UCService) GetAllUCServicesRequest(com.zimbra.soap.admin.message.GetAllUCServicesRequest) UCServiceInfo(com.zimbra.soap.admin.type.UCServiceInfo) ArrayList(java.util.ArrayList) GetAllUCServicesResponse(com.zimbra.soap.admin.message.GetAllUCServicesResponse)

Example 2 with UCService

use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.

the class DeleteUCService method handle.

public Element handle(Element request, Map<String, Object> context) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    Provisioning prov = Provisioning.getInstance();
    String id = request.getElement(AdminConstants.E_ID).getText();
    UCService ucService = prov.get(UCServiceBy.id, id);
    if (ucService == null) {
        throw AccountServiceException.NO_SUCH_UC_SERVICE(id);
    }
    checkRight(zsc, context, ucService, Admin.R_deleteUCService);
    prov.deleteUCService(ucService.getId());
    ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "DeleteUCService", "name", ucService.getName(), "id", ucService.getId() }));
    Element response = zsc.createElement(AdminConstants.DELETE_UC_SERVICE_RESPONSE);
    return response;
}
Also used : UCService(com.zimbra.cs.account.UCService) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element) Provisioning(com.zimbra.cs.account.Provisioning)

Example 3 with UCService

use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.

the class ModifyUCService method handle.

@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    Provisioning prov = Provisioning.getInstance();
    String id = request.getElement(AdminConstants.E_ID).getText();
    Map<String, Object> attrs = AdminService.getAttrs(request);
    UCService ucService = prov.get(Key.UCServiceBy.id, id);
    if (ucService == null) {
        throw AccountServiceException.NO_SUCH_UC_SERVICE(id);
    }
    checkRight(zsc, context, ucService, attrs);
    // pass in true to checkImmutable
    prov.modifyAttrs(ucService, attrs, true);
    ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "ModifyUCService", "name", ucService.getName() }, attrs));
    Element response = zsc.createElement(AdminConstants.MODIFY_UC_SERVICE_RESPONSE);
    GetUCService.encodeUCService(response, ucService, null, null);
    return response;
}
Also used : UCService(com.zimbra.cs.account.UCService) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element) Provisioning(com.zimbra.cs.account.Provisioning)

Example 4 with UCService

use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.

the class LdapProvisioning method extendLifeInCacheOrFlush.

public void extendLifeInCacheOrFlush(Entry entry) {
    if (entry instanceof Account) {
        accountCache.replace((Account) entry);
    } else if (entry instanceof LdapCos) {
        cosCache.replace((LdapCos) entry);
    } else if (entry instanceof Domain) {
        domainCache.replace((Domain) entry);
    } else if (entry instanceof Server) {
        serverCache.replace((Server) entry);
    } else if (entry instanceof UCService) {
        ucServiceCache.replace((UCService) entry);
    } else if (entry instanceof XMPPComponent) {
        xmppComponentCache.replace((XMPPComponent) entry);
    } else if (entry instanceof LdapZimlet) {
        zimletCache.replace((LdapZimlet) entry);
    } else if (entry instanceof LdapAlwaysOnCluster) {
        alwaysOnClusterCache.replace((AlwaysOnCluster) entry);
    } else if (entry instanceof Group) {
        /*
             * DLs returned by Provisioning.get(DistributionListBy) and
             * DLs/dynamic groups returned by Provisioning.getGroup(DistributionListBy)
             * are "not" cached.
             *
             * DLs returned by Provisioning.getDLBasic(DistributionListBy) and
             * DLs/dynamic groups returned by Provisioning.getGroupBasic(DistributionListBy)
             * "are" cached.
             *
             * Need to flush out the cached entries if the instance being modified is not
             * in cache. (i.e. the instance being modified was obtained by get/getGroup)
             */
        Group modifiedInstance = (Group) entry;
        Group cachedInstance = getGroupFromCache(DistributionListBy.id, modifiedInstance.getId());
        if (cachedInstance != null && modifiedInstance != cachedInstance) {
            groupCache.remove(cachedInstance);
        }
    }
}
Also used : Account(com.zimbra.cs.account.Account) GuestAccount(com.zimbra.cs.account.GuestAccount) LdapAccount(com.zimbra.cs.account.ldap.entry.LdapAccount) Group(com.zimbra.cs.account.Group) DynamicGroup(com.zimbra.cs.account.DynamicGroup) LdapDynamicGroup(com.zimbra.cs.account.ldap.entry.LdapDynamicGroup) LdapAlwaysOnCluster(com.zimbra.cs.account.ldap.entry.LdapAlwaysOnCluster) InMemoryLdapServer(com.zimbra.cs.ldap.unboundid.InMemoryLdapServer) LdapServer(com.zimbra.cs.account.ldap.entry.LdapServer) Server(com.zimbra.cs.account.Server) LdapUCService(com.zimbra.cs.account.ldap.entry.LdapUCService) UCService(com.zimbra.cs.account.UCService) LdapAlwaysOnCluster(com.zimbra.cs.account.ldap.entry.LdapAlwaysOnCluster) AlwaysOnCluster(com.zimbra.cs.account.AlwaysOnCluster) LdapZimlet(com.zimbra.cs.account.ldap.entry.LdapZimlet) LdapCos(com.zimbra.cs.account.ldap.entry.LdapCos) LdapDomain(com.zimbra.cs.account.ldap.entry.LdapDomain) Domain(com.zimbra.cs.account.Domain) XMPPComponent(com.zimbra.cs.account.XMPPComponent) LdapXMPPComponent(com.zimbra.cs.account.ldap.entry.LdapXMPPComponent)

Example 5 with UCService

use of com.zimbra.cs.account.UCService in project zm-mailbox by Zimbra.

the class LdapProvisioning method getUCServiceByName.

private UCService getUCServiceByName(String name, boolean nocache) throws ServiceException {
    if (!nocache) {
        UCService s = ucServiceCache.getByName(name);
        if (s != null) {
            return s;
        }
    }
    try {
        String dn = mDIT.ucServiceNameToDN(name);
        ZAttributes attrs = helper.getAttributes(LdapUsage.GET_UCSERVICE, dn);
        LdapUCService s = new LdapUCService(dn, attrs, this);
        ucServiceCache.put(s);
        return s;
    } catch (LdapEntryNotFoundException e) {
        return null;
    } catch (ServiceException e) {
        throw ServiceException.FAILURE("unable to lookup ucservice by name: " + name + " message: " + e.getMessage(), e);
    }
}
Also used : LdapUCService(com.zimbra.cs.account.ldap.entry.LdapUCService) UCService(com.zimbra.cs.account.UCService) AccountServiceException(com.zimbra.cs.account.AccountServiceException) AuthFailedServiceException(com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException) ServiceException(com.zimbra.common.service.ServiceException) LdapEntryNotFoundException(com.zimbra.cs.ldap.LdapException.LdapEntryNotFoundException) ZAttributes(com.zimbra.cs.ldap.ZAttributes) LdapUCService(com.zimbra.cs.account.ldap.entry.LdapUCService)

Aggregations

UCService (com.zimbra.cs.account.UCService)14 Provisioning (com.zimbra.cs.account.Provisioning)7 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)7 Element (com.zimbra.common.soap.Element)6 LdapUCService (com.zimbra.cs.account.ldap.entry.LdapUCService)5 ServiceException (com.zimbra.common.service.ServiceException)3 AccountServiceException (com.zimbra.cs.account.AccountServiceException)3 AuthFailedServiceException (com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException)3 Domain (com.zimbra.cs.account.Domain)2 Account (com.zimbra.cs.account.Account)1 AlwaysOnCluster (com.zimbra.cs.account.AlwaysOnCluster)1 DynamicGroup (com.zimbra.cs.account.DynamicGroup)1 Group (com.zimbra.cs.account.Group)1 GuestAccount (com.zimbra.cs.account.GuestAccount)1 Server (com.zimbra.cs.account.Server)1 XMPPComponent (com.zimbra.cs.account.XMPPComponent)1 AdminRight (com.zimbra.cs.account.accesscontrol.AdminRight)1 RightCommand (com.zimbra.cs.account.accesscontrol.RightCommand)1 CallbackContext (com.zimbra.cs.account.callback.CallbackContext)1 LdapAccount (com.zimbra.cs.account.ldap.entry.LdapAccount)1