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) });
public EventMemberRoleRequirement(EventMemberRole role) { Role = role; }