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); }
public static SimplePermissionRequirement For(SimplePermissionType permission) { return(new SimplePermissionRequirement(new SimplePermission(permission))); }
public PermissionAttribute(SimplePermissionType permission) : base($"Permission{permission}") { }
public SimplePermission(SimplePermissionType permission) { Permission = permission; }