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."); } }
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."); } }