public IPrivilege GetPrivilege(Object entity, params ISecurityScope[] securityScopes) { IList <IObjRef> objRefs = ObjRefHelper.ExtractObjRefList(entity, null); IPrivilegeResult result = GetPrivileges(objRefs, securityScopes); return(result.GetPrivileges()[0]); }
public ICacheWalkerResult WalkEntities <T>(params T[] entities) { IList <IObjRef> objRefs = new List <IObjRef>(entities.Length); objRefs = ObjRefHelper.ExtractObjRefList(entities, null, objRefs); IdentityHashSet <ICache> allCachesSet = new IdentityHashSet <ICache>(); foreach (Object entity in entities) { if (entity is IValueHolderContainer) { ICache targetCache = ((IValueHolderContainer)entity).__TargetCache; if (targetCache != null) { allCachesSet.Add(targetCache); } } } return(WalkIntern(ListUtil.ToArray(objRefs), allCachesSet)); }
public IPrivilegeResult GetPrivileges <V>(IList <V> entities, params ISecurityScope[] securityScopes) { IList <IObjRef> objRefs = ObjRefHelper.ExtractObjRefList(entities, null); return(GetPrivilegesByObjRef(objRefs, securityScopes)); }
protected CacheWalkerResult BuildWalkedEntry(ICache cache, IObjRef[] objRefs, IdentityHashMap <ICache, List <ICache> > cacheToChildCaches, IdentityHashMap <ICache, ICache> cacheToProxyCache) { List <ICache> childCaches = cacheToChildCaches.Get(cache); CacheWalkerResult[] childCacheEntries; if (childCaches == null) { childCacheEntries = null; } else { childCacheEntries = new CacheWalkerResult[childCaches.Count]; for (int a = childCaches.Count; a-- > 0;) { childCacheEntries[a] = BuildWalkedEntry(childCaches[a], objRefs, cacheToChildCaches, cacheToProxyCache); } } ICache proxyCache = cacheToProxyCache.Get(cache); bool transactional = false, threadLocal = false; if (proxyCache != null) { threadLocal = true; if (TransactionState != null && TransactionState.IsTransactionActive) { transactional = true; } } IList <Object> cacheValues; if (objRefs != allEntityRefs) { if (cache is ChildCache) { cacheValues = cache.GetObjects(objRefs, CacheDirective.FailEarly | CacheDirective.ReturnMisses); } else { cacheValues = cache.GetObjects(objRefs, CacheDirective.FailEarly | CacheDirective.CacheValueResult | CacheDirective.ReturnMisses); } } else { IdentityHashSet <Object> fCacheValues = new IdentityHashSet <Object>(); cache.GetContent(new HandleContentDelegate(delegate(Type entityType, sbyte idIndex, Object id, Object value) { fCacheValues.Add(value); })); cacheValues = fCacheValues.ToList(); // generate ad-hoc objRefs objRefs = cacheValues.Count > 0 ? ListUtil.ToArray(ObjRefHelper.ExtractObjRefList(cacheValues, null)) : ObjRef.EMPTY_ARRAY; } Object childEntries = childCacheEntries; if (childCacheEntries != null && childCacheEntries.Length == 1) { childEntries = childCacheEntries[0]; } CacheWalkerResult parentEntry = new CacheWalkerResult(cache, transactional, threadLocal, objRefs, ListUtil.ToArray(cacheValues), childEntries); if (childCacheEntries != null) { for (int a = childCacheEntries.Length; a-- > 0;) { childCacheEntries[a].ParentEntry = parentEntry; } } if (objRefs != allEntityRefs) { parentEntry.UpdatePendingChanges(); } return(parentEntry); }