Esempio n. 1
0
 private bool HasAccess(EventMemberRole role, EventMemberRole requiredRole)
 {
     return(requiredRole switch
     {
         // Surely there must be a better way of writing this :(
         EventMemberRole.Admin => (role == EventMemberRole.Admin),
         EventMemberRole.Organizer => (role == EventMemberRole.Admin || role == EventMemberRole.Organizer),
         EventMemberRole.Reviewer => (role == EventMemberRole.Admin || role == EventMemberRole.Organizer || role == EventMemberRole.Reviewer),
         _ => throw new ArgumentOutOfRangeException(nameof(requiredRole), requiredRole, null)
     });
Esempio n. 2
0
 public EventMemberRoleRequirement(EventMemberRole role)
 {
     Role = role;
 }