Exemplo n.º 1
0
        private async Task <List <User> > PermissionCheck(SimplePermissionType type)
        {
            var list = new List <User>();

            foreach (var user in _db.Fetch <User>())
            {
                var claimsPrincipal = await _factory.CreateAsync(user);

                var notify = (await _authorization.AuthorizeAsync(claimsPrincipal, null,
                                                                  SimplePermissionRequirement.For(type))).Succeeded;
                if (notify)
                {
                    list.Add(user);
                }
            }

            return(list);
        }
Exemplo n.º 2
0
 public static SimplePermissionRequirement For(SimplePermissionType permission)
 {
     return(new SimplePermissionRequirement(new SimplePermission(permission)));
 }
Exemplo n.º 3
0
 public PermissionAttribute(SimplePermissionType permission) : base($"Permission{permission}")
 {
 }
Exemplo n.º 4
0
 public SimplePermission(SimplePermissionType permission)
 {
     Permission = permission;
 }