コード例 #1
0
ファイル: Validations.cs プロジェクト: EBojilova/CSharpHQC
 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.");
     }
 }
コード例 #2
0
ファイル: Validations.cs プロジェクト: EBojilova/CSharpHQC
 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.");
     }
 }