コード例 #1
0
        public List <Category> GetAllowedCategories(IMemberGroup role, string actionType, PermissionService permissionService, MemberService memberService, CategoryPermissionService categoryPermissionService)
        {
            var cacheKey = string.Concat("GetAllowedCategoriesCode-", role.Id, "-", actionType);

            return((List <Category>)ApplicationContext.Current.ApplicationCache.RequestCache.GetCacheItem(cacheKey, () =>
            {
                var filteredCats = new List <Category>();
                var allCats = GetAll();
                foreach (var category in allCats)
                {
                    var permissionSet = permissionService.GetPermissions(category, role, memberService, categoryPermissionService);
                    if (!permissionSet[actionType].IsTicked)
                    {
                        // TODO Only add it category is NOT locked
                        filteredCats.Add(category);
                    }
                }
                return filteredCats;
            }));
        }
コード例 #2
0
 public List <Category> GetAllowedCategories(IMemberGroup role, PermissionService permissionService, MemberService memberService, CategoryPermissionService categoryPermissionService)
 {
     return(GetAllowedCategories(role, AppConstants.PermissionDenyAccess, permissionService, memberService, categoryPermissionService));
 }