public AttachmentRuleController(
			 IAuditService<AttachmentRule, AttachmentRuleAudit> auditService,
			IAttachmentRuleService attachmentRuleService)
        {
            this.AuditService = auditService;
            this.AttachmentRuleService = attachmentRuleService;
        }
        public SettingController(
			IAuditService<Setting, SettingAudit> auditService, 
			ISettingService settingService)
        {
            this.AuditService = auditService;
            this.SettingService = settingService;
        }
        public TimeZoneController(
			IAuditService<TimeZone, TimeZoneAudit> auditService,
			ITimeZoneService timeZoneService)
        {
            this.AuditService = auditService;
            this.TimeZoneService = timeZoneService;
        }
 public CartService(IAuditService auditService, ICartRepository cartRepository, IUserService userService, IProductRepository productRepository)
 {
     _auditService = auditService;
     _cartRepository = cartRepository;
     _userService = userService;
     _productRepository = productRepository;
 }
Exemple #5
0
 //  private readonly IEventManagerService _eventManagerService;
 public EmailService(IEmailService emailService, IMessageBusService messageBusService, IAuditService auditService/*, IEventManagerService eventManagerService*/)
 {
     _emailService = emailService;
     _messageBusService = messageBusService;
     _auditService = auditService;
      //   _eventManagerService = eventManagerService;
 }
        public CountryController(
			IAuditService<Country, CountryAudit> auditService,
			ICountryService countryService)
        {
            this.AuditService = auditService;
            this.CountryService = countryService;
        }
        public AttachmentController(
			IAuditService<Attachment, AttachmentAudit> auditService, 
			IAttachmentService attachmentService)
        {
            this.AuditService = auditService;
            this.AttachmentService = attachmentService;
        }
Exemple #8
0
        public HomeController(
			IAuditService<User, UserAudit> auditService,
			IUserService userService)
        {
            this.AuditService = auditService;
            this.UserService = userService;
        }
Exemple #9
0
        public RoleController(
			IAuditService<UserRole, UserRoleAudit> auditService,
			IUserService userService, 
			IUserRoleService userRoleService)
        {
            this.AuditService = auditService;
            this.UserService = userService;
            this.UserRoleService = userRoleService;
        }
 public BaseMessageHandler(IWorkPolicy policy, IAuditService auditService, ILogger logger) {
     WorkPolicy = policy;
     AuditService = auditService;
     Logger = logger;
     PolicyHandlers = new List<Tuple<Func<IWorkPolicyConclusion, bool>, Action<IProcessableUnit, PolicyResultHandler>>> {
         Tuple.Create<PRCHOICE, PREXEC>(pc => pc.Completed, (u, h) => h.Completed(u)),
         Tuple.Create<PRCHOICE, PREXEC>(pc => pc.Discard, (u, h) => h.Discard(u)),
         Tuple.Create<PRCHOICE, PREXEC>(pc => pc.Retry, (u, h) => h.Retry(u)),
         Tuple.Create<PRCHOICE, PREXEC>(pc => pc.PassToFailureHandling, (u, h) => h.ActivateFailureHandling(u)), 
         Tuple.Create<PRCHOICE, PREXEC>(pc => pc.Block, (u, h) => h.Block(u)) 
     };
     //Blocked = false;
 }
Exemple #11
0
 public PackagingService(
     IAuditService auditService,
     ICreatedPackagesRepository createdPackages,
     IPackageInstallation packageInstallation,
     IEventAggregator eventAggregator,
     IManifestParser manifestParser,
     IKeyValueService keyValueService,
     PackageMigrationPlanCollection packageMigrationPlans)
 {
     _auditService          = auditService;
     _createdPackages       = createdPackages;
     _packageInstallation   = packageInstallation;
     _eventAggregator       = eventAggregator;
     _manifestParser        = manifestParser;
     _keyValueService       = keyValueService;
     _packageMigrationPlans = packageMigrationPlans;
 }
        public TokenProviderService(IOptions <Toucan.Service.TokenProviderConfig> config, IAuditService audit)
        {
            this.audit  = audit;
            this.config = config.Value;

            SymmetricSecurityKey signingKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(this.config.TokenSecurityKey));

            this.options = new TokenProviderOptions
            {
                Audience           = this.config.TokenAudience,
                Issuer             = this.config.TokenIssuer,
                Expiration         = new TimeSpan(0, this.config.TokenExpiration, 0),
                SigningCredentials = new SigningCredentials(signingKey, this.config.TokenSecurityAlgorithm)
            };

            ThrowIfInvalidOptions(this.options);
        }
Exemple #13
0
 public AuditNotificationsHandler(
     IAuditService auditService,
     IUserService userService,
     IEntityService entityService,
     IIpResolver ipResolver,
     IOptionsMonitor <GlobalSettings> globalSettings,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     IMemberService memberService)
 {
     _auditService  = auditService;
     _userService   = userService;
     _entityService = entityService;
     _ipResolver    = ipResolver;
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
     _memberService  = memberService;
     _globalSettings = globalSettings.CurrentValue;
 }
Exemple #14
0
        public AuditTests()
        {
            DbContextOptions <FakeDbContext> mockOptions = new DbContextOptionsBuilder <FakeDbContext>()
                                                           .UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;

            _gspSession = A.Fake <IGspSession>();

            _dateTimeService = A.Fake <IDateTimeService>();

            _auditService = new AuditService(A.Fake <ILogger <AuditService> >(), _dateTimeService, _gspSession);

            _context = new FakeDbContext(mockOptions, _gspSession, _auditService);

            _fixture = new Fixture();

            _accountModel = _fixture.Create <GspUserAccountModel>();
        }
Exemple #15
0
 public CommissionErrorService(
     DataContext context,
     ICommissionService commissionService,
     IClientService clientService,
     ICommissionSplitService commissionSplitService,
     IPolicyService policyService,
     ICommissionSplitRulePolicyService commissionSplitRulePolicyService,
     IAuditService auditService)
 {
     _context                          = context;
     _commissionService                = commissionService;
     _clientService                    = clientService;
     _commissionSplitService           = commissionSplitService;
     _policyService                    = policyService;
     _commissionSplitRulePolicyService = commissionSplitRulePolicyService;
     _auditService                     = auditService;
 }
Exemple #16
0
        public BaseWasteCodeControllerTests()
        {
            this.mediator     = A.Fake <IMediator>();
            this.auditService = A.Fake <IAuditService>();

            controller = new TestController(mediator, CodeType.Y, this.auditService);

            viewModel = new TestViewModel
            {
                EnterWasteCodesViewModel = new EnterWasteCodesViewModel
                {
                    SelectedWasteCodes = selectedCodes
                }
            };

            A.CallTo(() => auditService.AddAuditEntry(this.mediator, AnyGuid, "user", NotificationAuditType.Added, NotificationAuditScreenType.BaselOecdCodes));
        }
Exemple #17
0
        /// <summary>
        /// The reason this is not in the constructor is solely for the purpose of exception handling.
        /// If you leave this in the controller and someone who is not authenticated calls the API you will not get a tenantId not found error.
        /// The error will be ugly and be hard to figure out you are not authorized.
        /// This way if the all methods have the ClaimsAuthorize attribute on them they will first be authenticated if not get a nice error message of not authorized.
        /// </summary>
        /// <exception cref="System.Exception">No Tenant Id Found.</exception>
        private void Setup()
        {
            //var isAllowed = ClaimsAuthorization.CheckAccess("Get", "CustomerId", "00");
            //isAllowed = true;
            //Get the current claims principal
            var identity = (ClaimsPrincipal)Thread.CurrentPrincipal;
            var tenant   = identity.Claims.Where(c => c.Type == ClaimsConstants.TenantIdClaimType).Select(c => c.Value).SingleOrDefault();

            if (string.IsNullOrEmpty(tenant))
            {
                throw new Exception("No Tenant Id Found.");
            }

            _tenantId = Guid.Parse(tenant);
            _user     = identity.Identity.Name;

            _auditService = AuditServiceFactory.Create(_tenantId);
        }
Exemple #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogScrubber"/> class.
 /// </summary>
 /// <param name="mainDom">Representation of the main application domain.</param>
 /// <param name="serverRegistrar">Provider of server registrations to the distributed cache.</param>
 /// <param name="auditService">Service for handling audit operations.</param>
 /// <param name="settings">The configuration for logging settings.</param>
 /// <param name="scopeProvider">Provides scopes for database operations.</param>
 /// <param name="logger">The typed logger.</param>
 /// <param name="profilingLogger">The profiling logger.</param>
 public LogScrubber(
     IMainDom mainDom,
     IServerRoleAccessor serverRegistrar,
     IAuditService auditService,
     IOptions <LoggingSettings> settings,
     IScopeProvider scopeProvider,
     ILogger <LogScrubber> logger,
     IProfilingLogger profilingLogger)
     : base(logger, TimeSpan.FromHours(4), DefaultDelay)
 {
     _mainDom         = mainDom;
     _serverRegistrar = serverRegistrar;
     _auditService    = auditService;
     _settings        = settings.Value;
     _scopeProvider   = scopeProvider;
     _logger          = logger;
     _profilingLogger = profilingLogger;
 }
Exemple #19
0
        private static void CheckAppSettings(IAuditService auditService)
        {
            var          appSettings = ConfigurationManager.AppSettings;
            const string fmt         = "{0,-35} = {1}";

            for (var i = 0; i < appSettings.Count; i++)
            {
                auditService.AuditActivity(string.Format(fmt, appSettings.GetKey(i), appSettings[i]),
                                           ConfigDiagnostics);
            }
            var connectionStrings = ConfigurationManager.ConnectionStrings;

            foreach (ConnectionStringSettings connection in connectionStrings)
            {
                var connectionString = connection.ConnectionString;
                auditService.AuditActivity(string.Format(fmt, connection.Name, connectionString), ConfigDiagnostics);
            }
        }
Exemple #20
0
 public AcceptInvitationCommandHandler(IInvitationRepository invitationRepository,
                                       IMembershipRepository membershipRepository,
                                       IUserAccountRepository userAccountRepository,
                                       IAuditService auditService,
                                       IEventPublisher eventPublisher,
                                       IValidator <AcceptInvitationCommand> validator,
                                       IHashingService hashingService,
                                       ILog logger)
 {
     _invitationRepository  = invitationRepository;
     _membershipRepository  = membershipRepository;
     _userAccountRepository = userAccountRepository;
     _auditService          = auditService;
     _eventPublisher        = eventPublisher;
     _validator             = validator;
     _hashingService        = hashingService;
     _logger = logger;
 }
Exemple #21
0
        private static void CheckDiskSpace(IAuditService auditService)
        {
            var vm = DiskSpaceCheck();

            auditService.AuditActivity(string.Format("There are {0} disks connected", vm.Disks.Count), DiskDiagnostics);
            foreach (var disk in vm.Disks)
            {
                auditService.AuditActivity(disk.Name, DiskDiagnostics);
                if (!disk.IsAvailable)
                {
                    continue;
                }
                auditService.AuditActivity(disk.DriveType, DiskDiagnostics);
                auditService.AuditActivity(disk.AvailableFreeSpace, DiskDiagnostics);
                auditService.AuditActivity(disk.SpaceUsed, DiskDiagnostics);
                auditService.AuditActivity(disk.PercentFreeSpace, DiskDiagnostics);
            }
        }
 public LogController(
     MediaFileManager mediaFileSystem,
     IImageUrlGenerator imageUrlGenerator,
     IAuditService auditService,
     IUmbracoMapper umbracoMapper,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IUserService userService,
     AppCaches appCaches,
     ISqlContext sqlContext)
 {
     _mediaFileManager           = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
     _imageUrlGenerator          = imageUrlGenerator ?? throw new ArgumentNullException(nameof(imageUrlGenerator));
     _auditService               = auditService ?? throw new ArgumentNullException(nameof(auditService));
     _umbracoMapper              = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
     _backofficeSecurityAccessor = backofficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backofficeSecurityAccessor));
     _userService = userService ?? throw new ArgumentNullException(nameof(userService));
     _appCaches   = appCaches ?? throw new ArgumentNullException(nameof(appCaches));
     _sqlContext  = sqlContext ?? throw new ArgumentNullException(nameof(sqlContext));
 }
Exemple #23
0
        private async Task AuditAsync(HttpContext context, IAuditService auditService)
        {
            var statusCode = context.Response.StatusCode;
            var endpoint   = context.GetEndpoint();

            var auditModel = new AuditPostModel
            {
                StatusCode   = statusCode,
                IsSuccessful = statusCode >= 200 && statusCode < 300,
                Method       = context.Request.Method,
                Endpoint     = endpoint.Metadata?.GetMetadata <HttpMethodAttribute>()?.Template,
                // Do not display body when it concerns the user endpoints (sensitive data such as passwords
                // cannot be stored as plaintext)
                Request = endpoint.DisplayName.Contains("users", StringComparison.CurrentCultureIgnoreCase)
                    ? null : await GetRequestAsync(context),
            };

            _logger.LogInformation($"Attempting to audit model {auditModel.SerializeCamelCase()}.");
            await auditService.AddAuditTrailAsync(auditModel);
        }
Exemple #24
0
        public ViewPageViewModel()
        {
            _deviceActionService      = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _cipherService            = ServiceContainer.Resolve <ICipherService>("cipherService");
            _userService              = ServiceContainer.Resolve <IUserService>("userService");
            _totpService              = ServiceContainer.Resolve <ITotpService>("totpService");
            _platformUtilsService     = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _auditService             = ServiceContainer.Resolve <IAuditService>("auditService");
            _messagingService         = ServiceContainer.Resolve <IMessagingService>("messagingService");
            CopyCommand               = new Command <string>((id) => CopyAsync(id, null));
            CopyUriCommand            = new Command <LoginUriView>(CopyUri);
            CopyFieldCommand          = new Command <FieldView>(CopyField);
            LaunchUriCommand          = new Command <LoginUriView>(LaunchUri);
            TogglePasswordCommand     = new Command(TogglePassword);
            ToggleCardCodeCommand     = new Command(ToggleCardCode);
            CheckPasswordCommand      = new Command(CheckPasswordAsync);
            DownloadAttachmentCommand = new Command <AttachmentView>(DownloadAttachmentAsync);

            PageTitle = AppResources.ViewItem;
        }
Exemple #25
0
 protected CrudService(
     IRoleService roleService,
     IFactory <TDto, TAggregateRoot> factory,
     IAggregateUpdater <TDto, TAggregateRoot> aggregateUpdater,
     IAuditService auditService,
     IDuplicateValidator <TDto> duplicateValidator,
     ITokenService tokenService,
     IUnitOfWork unitOfWork,
     ILogService logService,
     IAppSettingsService appSettingsService,
     IInventAppContext inventAppContext
     ) : base(tokenService, unitOfWork, logService, inventAppContext)
 {
     _factory            = factory;
     _aggregateUpdater   = aggregateUpdater;
     _auditService       = auditService;
     _duplicateValidator = duplicateValidator;
     _roleService        = roleService;
     _appSettingsService = appSettingsService;
 }
 public CommissionImportService(
     DataContext context,
     IBulkActions bulkActions,
     ICommissionStatementService commissionStatementService,
     IPolicyService policyService,
     IDirectoryLookupService lookupService,
     ICommissionLookupService commissionLookupService,
     ICommissionSplitService commissionSplitService,
     ICommissionSplitRulePolicyService commissionSplitRulePolicyService,
     IAuditService auditService)
 {
     _context       = context;
     _policyService = policyService;
     _lookupService = lookupService;
     _commissionStatementService = commissionStatementService;
     _bulkActions                      = bulkActions;
     _commissionLookupService          = commissionLookupService;
     _commissionSplitService           = commissionSplitService;
     _commissionSplitRulePolicyService = commissionSplitRulePolicyService;
     _auditService                     = auditService;
 }
Exemple #27
0
 public CrudService(
     LactalisDBContext dbContext,
     UserManager <User> userManager,
     ISecurityService securityService,
     IIdentityService identityService,
     ILogger <CrudService> logger,
     IServiceProvider serviceProvider,
     IUploadStorageProvider storageProvider,
     IUserService userService,
     IAuditService auditService)
 {
     _dbContext       = dbContext;
     _userManager     = userManager;
     _securityService = securityService;
     _identityService = identityService;
     _logger          = logger;
     _serviceProvider = serviceProvider;
     _storageProvider = storageProvider;
     _userService     = userService;
     _auditService    = auditService;
 }
Exemple #28
0
        public async Task CreateAsync_ShouldCreateAudit()
        {
            // Arrrange
            _auditRepositoryMock.Setup(m => m.AddAsync(_dmAudit)).Returns(Task.CompletedTask);
            _unitOfWorkMock.Setup(m => m.AuditRepository).Returns(_auditRepositoryMock.Object);
            _unitOfWorkMock.Setup(m => m.CommitAsync()).Returns(Task.CompletedTask);
            var smAudit = new ServiceModel.Audit()
            {
                Action = 5, Message = "Test", Severity = 1, Ukprn = 12345
            };
            IAuditService sut = GetAuditServiceHelper();

            // Act
            await sut.CreateAsync(smAudit);

            //Assert
            _auditRepositoryMock.Verify();
            _auditRepositoryMock.Verify(x => x.AddAsync(_dmAudit), Times.Once);
            _unitOfWorkMock.Verify(x => x.CommitAsync(), Times.Once);
            Mock.VerifyAll(_mockMapper);
        }
        public SchedulerComponent(
            IRuntimeState runtime,
            IContentService contentService,
            IContentVersionService service,
            IAuditService auditService,
            HealthCheckCollection healthChecks,
            HealthCheckNotificationMethodCollection notifications,
            IScopeProvider scopeProvider,
            IUmbracoContextFactory umbracoContextFactory,
            IProfilingLogger logger)
        {
            _runtime               = runtime;
            _contentService        = contentService;
            _service               = service;
            _auditService          = auditService;
            _scopeProvider         = scopeProvider;
            _logger                = logger;
            _umbracoContextFactory = umbracoContextFactory;

            _healthChecks  = healthChecks;
            _notifications = notifications;
        }
        public ProducerControllerTests()
        {
            mediator          = A.Fake <IMediator>();
            this.auditService = A.Fake <IAuditService>();
            A.CallTo(() => mediator.SendAsync(A <GetCountries> ._)).Returns(new List <CountryData>
            {
                new CountryData
                {
                    Id   = new Guid("4345FB05-F7DF-4E16-939C-C09FCA5C7D7B"),
                    Name = "United Kingdom"
                },
                new CountryData
                {
                    Id   = new Guid("29B0D09E-BA77-49FB-AF95-4171408C07C9"),
                    Name = "Germany"
                }
            });

            A.CallTo(() => mediator.SendAsync(A <GetProducerForNotification> ._)).Returns(CreateProducer(producerId));
            producerController = new ProducerController(mediator, new AddAddressBookEntryMap(), this.auditService);
            A.CallTo(() => auditService.AddAuditEntry(this.mediator, notificationId, "user", NotificationAuditType.Added, NotificationAuditScreenType.Producer));
        }
Exemple #31
0
        /// <summary>
        /// 执行任务完成时记录
        /// </summary>
        /// <param name="context"></param>
        public override void OnActionExecuted(ActionExecutedContext context)
        {
            if (!auditSwitch)
            {
                if (context.Result is ObjectResult)
                {
                    var resultObj = (context.Result as ObjectResult);
                    audit.Result = JsonConvert.SerializeObject(resultObj.Value);
                }
                audit.StatusCode = context.HttpContext.Response.StatusCode;
                if (context.Exception != null)
                {
                    audit.Exception = context.Exception.StackTrace;
                }
                stopwatch.Stop();
                audit.Duration = stopwatch.ElapsedMilliseconds;
                _auditService  = context.HttpContext.RequestServices.GetRequiredService <IAuditService>();
                _auditService.CreateAsync(audit);
            }

            base.OnActionExecuted(context);
        }
 public AccountManagementService(IAccountsRepository accountsRepository,
                                 ITradingConditionsService tradingConditionsService,
                                 ISendBalanceCommandsService sendBalanceCommandsService,
                                 AccountManagementSettings settings,
                                 IEventSender eventSender,
                                 ILog log,
                                 ISystemClock systemClock,
                                 AccountsCache cache,
                                 IAccountBalanceChangesRepository accountBalanceChangesRepository,
                                 IDealsApi dealsApi,
                                 IEodTaxFileMissingRepository taxFileMissingRepository,
                                 IAccountsApi accountsApi,
                                 IPositionsApi positionsApi,
                                 ITradingInstrumentsApi tradingInstrumentsApi,
                                 IFeatureManager featureManager,
                                 IAuditService auditService,
                                 CorrelationContextAccessor correlationContextAccessor,
                                 IBrokerSettingsCache brokerSettingsCache)
 {
     _accountsRepository         = accountsRepository;
     _tradingConditionsService   = tradingConditionsService;
     _sendBalanceCommandsService = sendBalanceCommandsService;
     _settings    = settings;
     _eventSender = eventSender;
     _log         = log;
     _systemClock = systemClock;
     _cache       = cache;
     _accountBalanceChangesRepository = accountBalanceChangesRepository;
     _dealsApi = dealsApi;
     _taxFileMissingRepository = taxFileMissingRepository;
     _accountsApi                = accountsApi;
     _positionsApi               = positionsApi;
     _tradingInstrumentsApi      = tradingInstrumentsApi;
     _featureManager             = featureManager;
     _auditService               = auditService;
     _correlationContextAccessor = correlationContextAccessor;
     _brokerSettingsCache        = brokerSettingsCache;
 }
Exemple #33
0
        public async Task InvokeAsync(HttpContext context, IAuditService auditService)
        {
            // Call the MVC middleware so we know HTTP status code
            await _next(context);

            var request  = context.Request;
            var response = context.Response;

            var pathArray = request.Path.Value.ToLower().Split('/', StringSplitOptions.RemoveEmptyEntries);

            if (response.StatusCode == StatusCodes.Status200OK &&
                request.Method == "GET" &&
                pathArray.Contains("notifications"))
            {
                // We only want to audit reads of pages, i.e. where paths are of form Notifications/{id} or /Notifications/{id}/Edit/{modelName}
                // We also make get requests for validation etc (which have longer paths), so ensure we ignore these here
                var maxIndex          = pathArray.Length - 1;
                var notificationIndex = Array.IndexOf(pathArray, "notifications");
                var shouldAudit       = (maxIndex > notificationIndex && maxIndex <= notificationIndex + 3);

                if (shouldAudit && int.TryParse(pathArray[notificationIndex + 1], out var id))
                {
                    var userName = UserHelper.GetUsername(context);

                    // TODO: Differentiate between Cluster and Full view.
                    await auditService.AuditNotificationReadAsync(id, NotificationAuditType.Full, userName);
                }
                ;
            }

            else if (response.StatusCode == StatusCodes.Status200OK &&
                     pathArray.Length == 1 &&
                     pathArray.Single() == "search" &&
                     request.QueryString.HasValue)
            {
                await auditService.AuditSearch(request.Query, UserHelper.GetUsername(context));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ContractService" /> class.
 /// </summary>
 /// <param name="repository">Contracts repository.</param>
 /// <param name="mapper">Automapper instance.</param>
 /// <param name="uriService">The uri service.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="auditService">The audit service used for auditing.</param>
 /// <param name="semaphoreOnEntity">The semaphore to use for locking.</param>
 /// <param name="documentService">The document management Contract Service.</param>
 /// <param name="contractValidator">The contract validator.</param>
 /// <param name="mediator">The mediator.</param>
 /// <param name="contractDocumentService">The blob container used to communicate with azure storage.</param>
 public ContractService(
     IContractRepository repository,
     IMapper mapper,
     IUriService uriService,
     ILoggerAdapter <ContractService> logger,
     IAuditService auditService,
     ISemaphoreOnEntity <string> semaphoreOnEntity,
     IDocumentManagementContractService documentService,
     IContractValidationService contractValidator,
     IMediator mediator,
     IContractDocumentService contractDocumentService)
 {
     _repository              = repository;
     _mapper                  = mapper;
     _uriService              = uriService;
     _logger                  = logger;
     _auditService            = auditService;
     _semaphoreOnEntity       = semaphoreOnEntity;
     _documentService         = documentService;
     _contractValidator       = contractValidator;
     _mediator                = mediator;
     _contractDocumentService = contractDocumentService;
 }
Exemple #35
0
 public AssetTypesService(
     IAssetTypesRepository assetTypesRepository,
     IClientProfilesRepository clientProfilesRepository,
     IClientProfileSettingsRepository clientProfileSettingsRepository,
     IAuditService auditService,
     IBrokerSettingsApi brokerSettingsApi,
     IRegulatoryTypesApi regulatoryTypesApi,
     IRegulatorySettingsApi regulatorySettingsApi,
     ICqrsEntityChangedSender entityChangedSender,
     IUnderlyingCategoriesCache underlyingCategoriesCache,
     string brokerId)
 {
     _assetTypesRepository            = assetTypesRepository;
     _clientProfilesRepository        = clientProfilesRepository;
     _clientProfileSettingsRepository = clientProfileSettingsRepository;
     _auditService              = auditService;
     _brokerSettingsApi         = brokerSettingsApi;
     _regulatoryTypesApi        = regulatoryTypesApi;
     _regulatorySettingsApi     = regulatorySettingsApi;
     _entityChangedSender       = entityChangedSender;
     _underlyingCategoriesCache = underlyingCategoriesCache;
     _brokerId = brokerId;
 }
 public GraphQlService(
     ISchema schema,
     IDocumentExecuter executer,
     LactalisDBContext dataContext,
     ISecurityService securityService,
     UserManager <User> userManager,
     IUserService userService,
     ICrudService crudService,
     IServiceProvider serviceProvider,
     IIdentityService identityService,
     IAuditService auditService)
 {
     _schema          = schema;
     _executer        = executer;
     _dataContext     = dataContext;
     _securityService = securityService;
     _userManager     = userManager;
     _userService     = userService;
     _crudService     = crudService;
     _identityService = identityService;
     _serviceProvider = serviceProvider;
     _auditService    = auditService;
 }
 public AcceptInvitationCommandHandler(IInvitationRepository invitationRepository,
                                       IMembershipRepository membershipRepository,
                                       IUserAccountRepository userAccountRepository,
                                       IAuditService auditService)
 {
     if (invitationRepository == null)
     {
         throw new ArgumentNullException(nameof(invitationRepository));
     }
     if (membershipRepository == null)
     {
         throw new ArgumentNullException(nameof(membershipRepository));
     }
     if (userAccountRepository == null)
     {
         throw new ArgumentNullException(nameof(userAccountRepository));
     }
     _invitationRepository  = invitationRepository;
     _membershipRepository  = membershipRepository;
     _userAccountRepository = userAccountRepository;
     _auditService          = auditService;
     _validator             = new AcceptInvitationCommandValidator();
 }
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            var scope = context.HttpContext.RequestServices.CreateScope();

            _logger = scope.ServiceProvider.GetRequiredService <ILogger <Audit> >();
            _logger.LogDebug("Executing audit filter");

            _auditService = scope.ServiceProvider.GetRequiredService <IAuditService>();
            if (_auditService == null)
            {
                throw new MSFrameworkException("AuditService is not registered");
            }

            _auditUnitOfWorkManager = scope.ServiceProvider.GetService <IUnitOfWorkManager>();

            var configuration   = scope.ServiceProvider.GetRequiredService <IConfiguration>();
            var applicationName = configuration["ApplicationName"];

            applicationName = string.IsNullOrWhiteSpace(applicationName)
                                ? Assembly.GetEntryAssembly()?.FullName
                                : applicationName;
            var path = context.ActionDescriptor.GetActionPath();
            var ua   = context.HttpContext.Request.Headers["User-Agent"].ToString();
            var ip   = context.GetRemoteIpAddress();

            _auditedOperation = new AuditOperation(applicationName, path, ip, ua);
            if (context.HttpContext.User?.Identity != null && context.HttpContext.User.Identity.IsAuthenticated &&
                context.HttpContext.User.Identity is ClaimsIdentity identity)
            {
                _auditedOperation.SetCreation(identity.GetUserId(), identity.GetUserName());
            }
            else
            {
                _auditedOperation.SetCreation("Anonymous", "Anonymous");
            }
        }
        public ChemicalCompositionControllerTests()
        {
            mediator                      = A.Fake <IMediator>();
            this.auditService             = A.Fake <IAuditService>();
            chemicalCompositionController = new ChemicalCompositionController(mediator, new ChemicalCompositionMap(), this.auditService);

            A.CallTo(
                () =>
                mediator.SendAsync(A <GetWasteType> .That.Matches(p => p.NotificationId == notificationId)))
            .Returns(new WasteTypeData()
            {
                WasteCompositionData = new List <WasteCompositionData>()
                {
                    A.Fake <WasteCompositionData>()
                }
            });

            A.CallTo(
                () => mediator.SendAsync(A <GetNotificationAuditTable> .That.Matches
                                             (p => p.NotificationId == notificationId)))
            .Returns(CreateTestAuditTable());

            A.CallTo(() => auditService.AddAuditEntry(this.mediator, notificationId, "user", NotificationAuditType.Added, NotificationAuditScreenType.ChemicalComposition));
        }
 public void Initialize()
 {
     repositoryMock = new Mock <IAuditRepository <Audit> >();
     unitWorkMock   = new Mock <IUnitOfWork>();
     serviceMock    = new AuditService(unitWorkMock.Object);
     items          = new List <Audit>()
     {
         new Audit
         {
             ID           = 1,
             EntityName   = "test",
             Logs         = "test",
             ModifiedBy   = "test",
             ModifiedDate = DateTime.Now,
             ModifiedFrom = "test"
         },
         new Audit
         {
             ID           = 2,
             EntityName   = "test",
             Logs         = "test",
             ModifiedBy   = "test",
             ModifiedDate = DateTime.Now,
             ModifiedFrom = "test"
         },
         new Audit
         {
             ID           = 3,
             EntityName   = "test",
             Logs         = "test",
             ModifiedBy   = "test",
             ModifiedDate = DateTime.Now,
             ModifiedFrom = "test"
         }
     };
 }
Exemple #41
0
 public RolesService(IRoleManager roleManager, IMessageBusService messageBusService, IAuditService auditService)
 {
     _roleManager = roleManager;
     _messageBusService = messageBusService;
     _auditService = auditService;
 }
Exemple #42
0
 public CourseService(ICourseManager courseManager, IMessageBusService messageBusService, IAuditService auditService)
 {
     _courseManager = courseManager;
     _messageBusService = messageBusService;
     _auditService = auditService;
 }
 public ApplicationServices(IApplicationManager applicationManager, IMessageBusService messageBusService, IAuditService auditService)
 {
     _applicationManager = applicationManager;
     _messageBusService = messageBusService;
     _auditService = auditService;
 }
 public ResourceLimitingMessageHandler(IWorkPolicy policy, IAuditService auditService, ILogger logger)
     : base(policy, auditService, logger)
 {
 }
Exemple #45
0
 public AuditController(IAuditService auditService, IUserProfileService userProfileService)
     : base(userProfileService)
 {
     this._auditService = auditService;
 }
 public InMemoryMessageHandler(IWorkPolicy policy, IAuditService auditService, ILogger logger)
     : base(policy, auditService, logger)
 {
     Pending = new ConcurrentQueue<IProcessableUnit>();
 }
 public AuditInterceptor()
 {
     auditService = ContextRegistry.GetContext()["auditService"] as IAuditService;
 }
 public AuditLogController(IAuditService auditLogService)
 {
     _auditLogService = auditLogService;
 }
 public ProductController(IProductService productService, IAuditService auditService, IUserService userService)
 {
     _productService = productService;
     _auditService = auditService;
     _userService = userService;
 }
Exemple #50
0
 public PageService(IPageManager pageManager, IMessageBusService messageBusService, IAuditService auditService)
 {
     _pageManager = pageManager;
     _messageBusService = messageBusService;
     _auditService = auditService;
 }
Exemple #51
0
 public UserService(IUserManager userManager, IMessageBusService messageBusService, IAuditService auditService)
 {
     _userManager = userManager;
     _messageBusService = messageBusService;
     _auditService = auditService;
 }
 public AuditController(IAuditService auditService)
 {
     this._auditService = auditService;
 }
 public RequestLogModule(IAuditService logService)
 {
     _logService = logService;
 }
 public InventoryService(MicroManageContext context, INotifierService notifierService, IAuditService auditService, IProductService productService) {
     this.Context = context;
     this.NotifierService = notifierService;
     this.AuditService = auditService;
     this.ProductService = productService;
 }
Exemple #55
0
 public EventService(IEventManagerService eventManager, IMessageBusService messageBusService, IAuditService auditService)
 {
     _eventManager = eventManager;
     _messageBusService = messageBusService;
     _auditService = auditService;
 }