Пример #1
0
        private SecurityToken GetToken(Guid id, SecurityContext context)
        {
            var  permissions = Cachier.Get <SecurityPermissions>(id);
            bool canRead     = (context.BelongingGroups.Any(k => permissions.AllowedForRead.Any(k2 => k2 == k)));
            bool canWrite    = (context.BelongingGroups.Any(k => permissions.AllowedForWrite.Any(k2 => k2 == k)));

            return(CreateToken(canRead, canWrite));
        }
Пример #2
0
        public override ISecurityContext GetContext()
        {
            var id      = Session.UserId;
            var context = new SecurityContext {
                SessionCode = id
            };
            var groups = Cachier.Get <SecurityGroup>(id);

            context.BelongingGroups = groups.Groups;
            return(context);
        }