コード例 #1
0
ファイル: LapController.cs プロジェクト: zaeja/laps-web
        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);
        }
コード例 #2
0
ファイル: LapController.cs プロジェクト: zaeja/laps-web
 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));
 }