예제 #1
0
 protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement)
 {
     if (context.User != null)
     {
         bool hasPermission = permissionService.CheckPermissionForUser(context.User, requirement.Permission);
         if (hasPermission)
         {
             context.Succeed(requirement);
             return(Task.CompletedTask);
         }
     }
     context.Fail();
     return(Task.CompletedTask);
 }