Exemple #1
0
 public static bool Authorized(this RoleType role, Permission[] permissions, bool all)
 {
     if (all)
     {
         return(role != RoleType.Disabled && (role == RoleType.Admin || permissions.All(t => role.Permissions().Contains(t))));
     }
     else
     {
         return(role != RoleType.Disabled && (role == RoleType.Admin || permissions.Any(t => role.Permissions().Contains(t))));
     }
 }