src/fursvp.domain/Authorization/ReadAuthorization/ReadAuthorizeEvent.cs
/// <summary>
/// Finds any unauthorized content within the Event object and redacts it if the user is not authorized to view it.
/// </summary>
/// <param name="event">The event information being viewed.</param>
Finds any unauthorized content within the Event object and redacts it if the user is not authorized to view it.
Finds any unauthorized content within the Event object and redacts it if the user is not authorized to view it .
public void FilterUnauthorizedContent(TEvent @event)
        {
            if (@event?.Members == null)
            {
                return;
            }
            foreach (var member in @event.Members.Where(m => !ReadAuthorizeMember.CanRead(m)).ToList()) 
            {
                @event.Members.Remove(member);
            }
            var actingMember = @event.Members.FirstOrDefault(m => m.EmailAddress == UserAccessor.User?.EmailAddress);
            if (actingMember != null && (actingMember.IsAuthor || actingMember.IsOrganizer))
            {
                return;
            }
            foreach (var member in @event.Members)
            {
                ReadAuthorizeMember.FilterUnauthorizedContent(member);
            }
        }
public void FilterUnauthorizedContent ( TEvent @event ) { if ( @event ? . Members == null ) { return ; } foreach ( var member in @event . Members . Where ( m => ! ReadAuthorizeMember . CanRead ( m ) ) . ToList ( ) ) { @event . Members . Remove ( member ) ; } var actingMember = @event . Members . FirstOrDefault ( m => m . EmailAddress == UserAccessor . User ? . EmailAddress ) ; if ( actingMember != null && ( actingMember . IsAuthor || actingMember . IsOrganizer ) ) { return ; } foreach ( var member in @event . Members ) { ReadAuthorizeMember . FilterUnauthorizedContent ( member ) ; } }
Finds any unauthorized content within the Event object and redacts it if the user is not authorized to view it.
Finds any unauthorized content within the Event object and redacts it if the user is not authorized to view it .
@event
TEvent
event
The event information being viewed.
The event information being viewed .