Example #1
0
 public static void ValidateRoles(User user)
 {
     if (!user.IsInRole(Role.Student) && !user.IsInRole(Role.Lecturer))
     {
         throw new AuthorizationFailedException("The current user is not authorized to perform this operation.");
     }
 }
Example #2
0
 public static void ValidateLectureRole(User user)
 {
     if (!user.IsInRole(Role.Lecturer))
     {
         // TODO: AuthorizationFailedException
         throw new ArgumentException("The current user is not authorized to perform this operation.");
     }
 }