Beispiel #1
0
        private bool IsReaderAuthorized(ReaderElement reader, UserPrincipal currentUser)
        {
            Principal readerPrincipal = Directory.GetPrincipal(reader.Principal);

            if (currentUser.Equals(readerPrincipal))
            {
                return(true);
            }

            if (readerPrincipal is GroupPrincipal group)
            {
                if (Directory.IsPrincipalInGroup(currentUser, group))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
 private ViewResult AuditAndReturnErrorResponse(LapRequestModel model, string userMessage, int eventID, string logMessage = null, Exception ex = null, TargetElement target = null, ReaderElement reader = null, UserPrincipal user = null, ComputerPrincipal computer = null)
 {
     Reporting.PerformAuditFailureActions(model, userMessage, eventID, logMessage, ex, target, reader, user, computer);
     model.FailureReason = userMessage;
     return(this.View("Get", model));
 }