private static DEContainerAndPermissionCollection GetPrincipalPermissions(IPrincipal principal, params string[] containerIDs) { string calculatedKey = CalculatePrincipalAndPermissionKey(principal, containerIDs); return((DEContainerAndPermissionCollection)ObjectContextCache.Instance.GetOrAddNewValue(calculatedKey, (cache, key) => { DEContainerAndPermissionCollection permissions = DEAclAdapter.Instance.LoadCurrentContainerAndPermissions(GetUserID(principal), containerIDs); cache.Add(key, permissions); return permissions; })); }
/// <summary> /// 是否拥有指定的权限 /// </summary> /// <param name="principal"></param> /// <param name="permissions"></param> /// <param name="permissionName"></param> /// <param name="containerIDs"></param> /// <returns></returns> public static bool HasPermissions(this IPrincipal principal, DEContainerAndPermissionCollection permissions, string permissionName, params string[] containerIDs) { bool result = IsSupervisor(principal); if (result == false) { if (principal != null) { permissions.NullCheck("permissions"); foreach (string containerID in containerIDs) { if (permissions.ContainsKey(containerID, permissionName)) { result = true; break; } } } } return(result); }
public DictionaryDebugView(DEContainerAndPermissionCollection collection) { this.collection = collection; }