src/fursvp.domain/Authorization/ReadAuthorization/ReadAuthorizeEvent.cs
/// <summary>
/// Indicates whether the current user is allowed to view any information related to this event.
/// </summary>
/// <param name="event">The event information being viewed.</param>
/// <returns>A value indicating whether the user is allowed to view any information related to this event.</returns>
Indicates whether the current user is allowed to view any information related to this event.
Indicates whether the current user is allowed to view any information related to this event .
public bool CanRead(TEvent @event)
        {
            if (@event == null || @event.IsPublished == true)
            {
                return true;
            }
            const bool organizersCanViewUnpublishedEvent = false;
            var actingMember = @event.Members.FirstOrDefault(m => m.EmailAddress == UserAccessor.User?.EmailAddress);
            if (actingMember?.IsAuthor == true)
            {
                return true;
            }
            if (actingMember?.IsOrganizer == true)
            {
                return organizersCanViewUnpublishedEvent;
            }
            return false;
        }
public bool CanRead ( TEvent @event ) { if ( @event == null || @event . IsPublished == true ) { return true ; } const bool organizersCanViewUnpublishedEvent = false ; var actingMember = @event . Members . FirstOrDefault ( m => m . EmailAddress == UserAccessor . User ? . EmailAddress ) ; if ( actingMember ? . IsAuthor == true ) { return true ; } if ( actingMember ? . IsOrganizer == true ) { return organizersCanViewUnpublishedEvent ; } return false ; }
Indicates whether the current user is allowed to view any information related to this event.
Indicates whether the current user is allowed to view any information related to this event .
A value indicating whether the user is allowed to view any information related to this event.
A value indicating whether the user is allowed to view any information related to this event .
@event
TEvent
event
The event information being viewed.
The event information being viewed .