Exemplo n.º 1
0
        public void AuditChangeToOrganisation(Controller controller, AuditedAction action, Organisation organisation,
                                              object anonymousObject)
        {
            var details = ExtractDictionaryOfDetailsFromAnonymousObject(anonymousObject);

            AuditActionToOrganisation(controller, action, organisation.OrganisationId, details);
        }
Exemplo n.º 2
0
        private void AuditActionToUser(Controller controller, AuditedAction action, long actionTakenOnUserId,
                                       Dictionary <string, string> details)
        {
            if (controller == null)
            {
                throw new ArgumentNullException(nameof(controller));
            }

            var impersonatedUserId = session["ImpersonatedUserId"].ToInt64();
            var isImpersonating    = impersonatedUserId > 0;
            var originalUserId     = session["OriginalUser"].ToInt64();
            var currentUser        = controller.User.Identity.IsAuthenticated
                ? dataRepository.FindUser(controller?.User)
                : null;

            var originalUser     = isImpersonating ? dataRepository.Get <User>(originalUserId) : currentUser;
            var impersonatedUser = dataRepository.Get <User>(actionTakenOnUserId);

            if (impersonatedUser.UserId == originalUser.UserId)
            {
                impersonatedUser = null;
            }

            dataRepository.Insert(
                new AuditLog
            {
                Action            = action,
                OriginalUser      = originalUser,
                ImpersonatedUser  = impersonatedUser,
                Organisation      = null,
                DetailsDictionary = details
            });

            dataRepository.SaveChangesAsync().Wait();
        }
Exemplo n.º 3
0
        public void AuditChangeToOrganisation(AuditedAction action, Organisation organisationChanged, object anonymousObject, User userWhoPerformedAction)
        {
            var users = new OriginalAndImpersonatedUser {
                OriginalUser = userWhoPerformedAction
            };

            AuditAction(action, organisationChanged.OrganisationId, anonymousObject, users);
        }
Exemplo n.º 4
0
        public void AuditChangeToUser(AuditedAction action, User userChanged, object anonymousObject, User userWhoPerformedAction)
        {
            var users = new OriginalAndImpersonatedUser {
                OriginalUser = userWhoPerformedAction
            };

            AuditAction(action, null, anonymousObject, users);
        }
Exemplo n.º 5
0
        private void AuditAction(AuditedAction action, long?organisationId, object anonymousObject, OriginalAndImpersonatedUser users)
        {
            Dictionary <string, string> details = ExtractDictionaryOfDetailsFromAnonymousObject(anonymousObject);

            Organisation organisation = organisationId.HasValue ? dataRepository.Get <Organisation>(organisationId.Value) : null;

            dataRepository.Insert(
                new AuditLog
            {
                Action           = action,
                OriginalUser     = users.OriginalUser,
                ImpersonatedUser = users.ImpersonatedUser,
                Organisation     = organisation,
                Details          = details
            });

            dataRepository.SaveChanges();
        }
Exemplo n.º 6
0
        public void AuditChangeToUser(Controller controller, AuditedAction action, User user, object anonymousObject)
        {
            var details = ExtractDictionaryOfDetailsFromAnonymousObject(anonymousObject);

            AuditActionToUser(controller, action, user.UserId, details);
        }
Exemplo n.º 7
0
 private static void AddFooDto(List <AuditedActionDto> dtos, AuditedAction action)
 {
     IWindsorContainer container = new WindsorContainer();
 }
Exemplo n.º 8
0
        public void AuditChangeToUser(AuditedAction action, User userChanged, object anonymousObject)
        {
            var users = new OriginalAndImpersonatedUser();

            AuditAction(action, null, anonymousObject, users);
        }
Exemplo n.º 9
0
        public void AuditChangeToUser(AuditedAction action, User userChanged, object anonymousObject, IPrincipal userWhoPerformedAction)
        {
            OriginalAndImpersonatedUser users = GetOriginalAndImpersonatedUser(userWhoPerformedAction);

            AuditAction(action, null, anonymousObject, users);
        }
Exemplo n.º 10
0
        public void AuditChangeToOrganisation(AuditedAction action, Organisation organisationChanged, object anonymousObject, IPrincipal userWhoPerformedAction)
        {
            OriginalAndImpersonatedUser users = GetOriginalAndImpersonatedUser(userWhoPerformedAction);

            AuditAction(action, organisationChanged.OrganisationId, anonymousObject, users);
        }
Exemplo n.º 11
0
        public void AuditChangeToOrganisation(AuditedAction action, Organisation organisationChanged, object anonymousObject)
        {
            var users = new OriginalAndImpersonatedUser();

            AuditAction(action, organisationChanged.OrganisationId, anonymousObject, users);
        }