Search in sources :

Example 1 with CacheEntrySelector

use of com.zimbra.soap.admin.type.CacheEntrySelector in project zm-mailbox by Zimbra.

the class SoapProvisioning method flushCache.

/*
     * invoked from ProvUtil, as it has to support skin and locale caches, which are not
     * managed by Provisioning.
     */
public void flushCache(String type, CacheEntry[] entries, boolean allServers) throws ServiceException {
    CacheSelector sel = new CacheSelector(allServers, type);
    if (entries != null) {
        for (CacheEntry entry : entries) {
            sel.addEntry(new CacheEntrySelector(SoapProvisioning.toJaxb(entry.mEntryBy), entry.mEntryIdentity));
        }
    }
    invokeJaxb(new FlushCacheRequest(sel));
}
Also used : CacheSelector(com.zimbra.soap.admin.type.CacheSelector) CacheEntrySelector(com.zimbra.soap.admin.type.CacheEntrySelector)

Example 2 with CacheEntrySelector

use of com.zimbra.soap.admin.type.CacheEntrySelector in project zm-mailbox by Zimbra.

the class GrantRight method handle.

@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    GrantRightRequest grReq = JaxbUtil.elementToJaxb(request);
    RightModifierInfo modifierInfo = grReq.getRight();
    if (modifierInfo == null) {
        throw ServiceException.INVALID_REQUEST("No information specified on what right to assign", null);
    }
    RightModifier rightModifier = getRightModifier(modifierInfo);
    // right checking is done in RightCommand
    EffectiveRightsTargetSelector erTargSel = grReq.getTarget();
    RightCommand.grantRight(Provisioning.getInstance(), getAuthenticatedAccount(zsc), erTargSel, grReq.getGrantee(), modifierInfo.getValue(), rightModifier);
    // Bug 100965 Avoid Cross server delegate admin being broken after initial creation due to stale caches
    if (com.zimbra.soap.type.TargetType.domain == erTargSel.getType()) {
        TargetBy by = erTargSel.getBy();
        if ((TargetBy.id == by) || (TargetBy.name == by)) {
            CacheSelector cacheSel = new CacheSelector(true, /* allServers */
            CacheEntryType.domain.toString());
            CacheEntrySelector ceSel = new CacheEntrySelector((TargetBy.id == erTargSel.getBy()) ? CacheEntryBy.id : CacheEntryBy.name, erTargSel.getValue());
            cacheSel.addEntry(ceSel);
            FlushCacheRequest fcReq = new FlushCacheRequest(cacheSel);
            try {
                FlushCache.doFlushCache(this, context, fcReq);
            } catch (ServiceException se) {
                ZimbraLog.acl.info("Problem flushing acl cache for domain %s/%s after granting rights", erTargSel.getBy(), erTargSel.getValue(), se);
            }
        }
    }
    Element response = zsc.createElement(AdminConstants.GRANT_RIGHT_RESPONSE);
    return response;
}
Also used : CacheSelector(com.zimbra.soap.admin.type.CacheSelector) RightModifierInfo(com.zimbra.soap.admin.type.RightModifierInfo) GrantRightRequest(com.zimbra.soap.admin.message.GrantRightRequest) CacheEntrySelector(com.zimbra.soap.admin.type.CacheEntrySelector) ServiceException(com.zimbra.common.service.ServiceException) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) Element(com.zimbra.common.soap.Element) RightModifier(com.zimbra.cs.account.accesscontrol.RightModifier) FlushCacheRequest(com.zimbra.soap.admin.message.FlushCacheRequest) TargetBy(com.zimbra.soap.type.TargetBy) EffectiveRightsTargetSelector(com.zimbra.soap.admin.type.EffectiveRightsTargetSelector)

Example 3 with CacheEntrySelector

use of com.zimbra.soap.admin.type.CacheEntrySelector in project zm-mailbox by Zimbra.

the class FlushCache method getCacheEntries.

private static CacheEntry[] getCacheEntries(CacheSelector cacheSelector) throws ServiceException {
    List<CacheEntrySelector> cacheEntrySelectors = cacheSelector.getEntries();
    if (cacheEntrySelectors.size() < 1) {
        return null;
    }
    CacheEntry[] entries = new CacheEntry[cacheEntrySelectors.size()];
    int i = 0;
    for (CacheEntrySelector cacheEntrySelector : cacheEntrySelectors) {
        entries[i++] = new CacheEntry(cacheEntrySelector.getBy().toKeyCacheEntryBy(), cacheEntrySelector.getKey());
    }
    return entries;
}
Also used : CacheEntrySelector(com.zimbra.soap.admin.type.CacheEntrySelector) CacheEntry(com.zimbra.cs.account.Provisioning.CacheEntry)

Aggregations

CacheEntrySelector (com.zimbra.soap.admin.type.CacheEntrySelector)3 CacheSelector (com.zimbra.soap.admin.type.CacheSelector)2 ServiceException (com.zimbra.common.service.ServiceException)1 Element (com.zimbra.common.soap.Element)1 CacheEntry (com.zimbra.cs.account.Provisioning.CacheEntry)1 RightModifier (com.zimbra.cs.account.accesscontrol.RightModifier)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 FlushCacheRequest (com.zimbra.soap.admin.message.FlushCacheRequest)1 GrantRightRequest (com.zimbra.soap.admin.message.GrantRightRequest)1 EffectiveRightsTargetSelector (com.zimbra.soap.admin.type.EffectiveRightsTargetSelector)1 RightModifierInfo (com.zimbra.soap.admin.type.RightModifierInfo)1 TargetBy (com.zimbra.soap.type.TargetBy)1