Beispiel #1
0
 public virtual void SaveRoleInCache(RoleCacheItem item)
 {
     cache.Store(item.RoleId.ToString(), item);
 }
Beispiel #2
0
        protected virtual Dictionary <string, DataAccessPermission> Append(Dictionary <string, DataAccessPermission> permissions, RoleCacheItem roleItem)
        {
            foreach (var r in roleItem.Resources)
            {
                if (!permissions.TryGetValue(r.Key, out DataAccessPermission perm))
                {
                    perm = new DataAccessPermission(0);
                }

                if (roleItem.Collections != null && roleItem.Collections.TryGetValue(r.Key, out string coll))
                {
                    perm.CollectionId = coll;
                }

                perm.Append(r.Value);
                var acs = roleItem.Actions.Where(d => d.Id == r.Key).Select(d => d.Action);
                foreach (var a in acs)
                {
                    perm.Append(a);
                }
                permissions[r.Key] = perm;
            }
            return(permissions);
        }