public ServiceVersionedRoleChecker(IUserIdentification userIdentification,
                                    IHttpContextAccessor ctxAccessor,
                                    IUserOrganizationService userOrganizationService) : base(ctxAccessor)
 {
     this.userOrganizationService = userOrganizationService;
     this.userIdentification      = userIdentification;
 }
Exemplo n.º 2
0
 protected void ThrowError(IUserIdentification userIdentification, IEnumerable <UserRoleEnum> roles)
 {
     throw new RoleActionException("User has no rights to update or create this entity!",
                                   new List <string> {
         userIdentification.UserName, string.Join(",", roles)
     });
 }
Exemplo n.º 3
0
 public ServiceService(
     IContextManager contextManager,
     IUserIdentification userIdentification,
     ITranslationEntity translationManagerToVm,
     ITranslationViewModel translationManagerToEntity,
     ILogger <Services.ChannelService> logger,
     ServiceChannelLogic channelLogic,
     ServiceUtilities utilities,
     ICommonServiceInternal commonService,
     IGeneralDescriptionService generalDescriptionService,
     VmListItemLogic listItemLogic,
     DataUtils dataUtils,
     VmOwnerReferenceLogic ownerReferenceLogic,
     ICacheManager cacheManager,
     IPublishingStatusCache publishingStatusCache,
     IUserOrganizationChecker userOrganizationChecker,
     IValidationManager validationManager,
     IUserOrganizationService userOrganizationService,
     IVersioningManager versioningManager
     ) :
     base(translationManagerToVm, translationManagerToEntity, publishingStatusCache, userOrganizationChecker, contextManager, utilities, commonService, validationManager)
 {
     this.logger                    = logger;
     this.channelLogic              = channelLogic;
     this.userIdentification        = userIdentification;
     this.listItemLogic             = listItemLogic;
     this.dataUtils                 = dataUtils;
     this.ownerReferenceLogic       = ownerReferenceLogic;
     this.generalDescriptionService = generalDescriptionService;
     this.typesCache                = cacheManager.TypesCache;
     this.languageCache             = cacheManager.LanguageCache;
     this.userOrganizationService   = userOrganizationService;
     this.versioningManager         = versioningManager;
 }
Exemplo n.º 4
0
 public StatutoryServiceGeneralDescriptionChecker(
     IUserIdentification userIdentification,
     IHttpContextAccessor ctxAccessor,
     IUserOrganizationService userOrganizationService, ITypesCache typesCache) : base(ctxAccessor)
 {
     this.userOrganizationService = userOrganizationService;
     this.userIdentification      = userIdentification;
     this.typesCache = typesCache;
 }
Exemplo n.º 5
0
 public UnitOfWorkWritable(IResolveManager resolveManager, PtvDbContext dbContext, IUserIdentification userIdentification, ILogger <UnitOfWorkWritable> logger, ApplicationConfiguration applicationConfiguration, ILockingManager lockingManager, IRoleChecker roleChecker, ITranslationCloneCache translationCloneCache) : base(resolveManager, dbContext)
 {
     this.userIdentification       = userIdentification;
     this.logger                   = logger;
     this.applicationConfiguration = applicationConfiguration;
     this.lockingManager           = lockingManager;
     this.roleChecker              = roleChecker;
     this.translationCloneCache    = translationCloneCache;
 }
Exemplo n.º 6
0
 public OrganizationRoleChecker(
     IUserIdentification userIdentification,
     IHttpContextAccessor ctxAccessor,
     IUserOrganizationService userOrganizationService, ITypesCache typesCache) : base(ctxAccessor)
 {
     this.userOrganizationService = userOrganizationService;
     this.userIdentification      = userIdentification;
     this.typesCache = typesCache;
 }
 public DefaultABsoluteMaybe(IExperimentCommands experimentCommands,
                             IOptionChooser optionChooser,
                             IOptionSerializer optionSerializer,
                             IEnumerable <IShortCircuiter> shortCircuiters,
                             IEnumerable <IUserFilter> userFilters,
                             IUserIdentification userIdentification
                             )
 {
     _experimentCommands = experimentCommands;
     _optionChooser      = optionChooser;
     _optionSerializer   = optionSerializer;
     _shortCircuiters    = shortCircuiters;
     _userFilters        = userFilters;
     _userIdentification = userIdentification;
 }
Exemplo n.º 8
0
 public ServiceUtilities(
     IUserIdentification userIdentification,
     ILockingManager lockingManager,
     IContextManager contextManager,
     IUserOrganizationService userOrganizationService,
     IVersioningManager versioningManager,
     IUserInfoService userInfoService,
     IUserOrganizationChecker userOrganizationChecker)
 {
     this.userIdentification      = userIdentification;
     this.lockingManager          = lockingManager;
     this.contextManager          = contextManager;
     this.userOrganizationService = userOrganizationService;
     this.versioningManager       = versioningManager;
     this.userInfoService         = userInfoService;
     this.userOrganizationChecker = userOrganizationChecker;
 }
Exemplo n.º 9
0
        public ContextManager(ILoggerFactory loggerFactory, IServiceProvider serviceProvider, IUserIdentification userIdentification, IOptions <DataContextOptions> dataContextOptions)
        {
            this.serviceProvider    = serviceProvider;
            this.userIdentification = userIdentification;
            this.logger             = loggerFactory.CreateLogger(this.GetType().Name);
            var retriesOnDeadlockSetting = dataContextOptions.Value?.RetriesOnDeadlock;

            if (retriesOnDeadlockSetting == null)
            {
                RetriesOnTemporaryFail = 0;
            }
            else
            {
                var deadlockRetriesSetting = retriesOnDeadlockSetting?.ParseToInt();
                if (deadlockRetriesSetting != null)
                {
                    RetriesOnTemporaryFail = deadlockRetriesSetting.Value;
                }
            }
        }
Exemplo n.º 10
0
 public RequestFilteringMiddleware(RequestDelegate next, string tag, IHttpContextAccessor httpContextAccessor, IUserIdentification userIdentification, IConfigurationService configurationService, IOptions <RequestFilterAppSetting> appSettings)
 {
     this.nextDelegate        = next;
     this.httpContextAccessor = httpContextAccessor;
     this.tag = tag;
     this.userIdentification   = userIdentification;
     this.configurationService = configurationService;
     this.appSettings          = appSettings.Value;
     if (this.appSettings != null)
     {
         ipAddressLimitGlobal = this.appSettings.MaxRequestsPerIp;
         userLimitGlobal      = this.appSettings.MaxRequestsPerUser;
     }
     if (ipAddressLimitGlobal <= 0)
     {
         ipAddressLimitGlobal = int.MaxValue;
     }
     if (userLimitGlobal <= 0)
     {
         userLimitGlobal = int.MaxValue;
     }
 }
Exemplo n.º 11
0
        public LockingManagerTests()
        {
            var service = new ServiceVersioned()
            {
                Id = Guid.NewGuid()
            };

            servicesDbSet = new List <ServiceVersioned>()
            {
                service
            };
            lockingDbSet        = new List <Locking>();
            unitOfWorkMockSetup = new Mock <IUnitOfWorkWritable>();

            publishingStatusCache = new Mock <IPublishingStatusCache>();
            publishingStatusCache.Setup(i => i.Get(It.IsAny <PublishingStatus>())).Returns <PublishingStatus>(j => j.ToString().GetGuid());
            publishingStatusCache.Setup(i => i.Get(It.IsAny <string>())).Returns <string>(j => j.GetGuid());
            serviceRepositoryMockSetup = new Mock <IServiceVersionedRepository>();
            serviceRepositoryMockSetup.Setup(i => i.All()).Returns(servicesDbSet.AsQueryable());
            serviceRepositoryMockSetup.Setup(i => i.Add(It.IsAny <ServiceVersioned>())).Returns <ServiceVersioned>(i => { servicesDbSet.Add(i); return(i); });
            lockingRepositoryMockSetup = new Mock <ILockingRepository>();
            lockingRepositoryMockSetup.Setup(i => i.All()).Returns(lockingDbSet.AsQueryable());
            lockingRepositoryMockSetup.Setup(i => i.Add(It.IsAny <Locking>())).Returns <Locking>(i => { lockingDbSet.Add(i); return(i); });
            lockingRepositoryMockSetup.Setup(i => i.Remove(It.IsAny <Locking>())).Callback <Locking>(i => { lockingDbSet.Remove(i); });
            userIdentificationMockSetup = new Mock <IUserIdentification>();

            unitOfWorkMockSetup.Setup(uw => uw.CreateRepository <IServiceVersionedRepository>()).Returns(serviceRepositoryMockSetup.Object);
            unitOfWorkMockSetup.Setup(uw => uw.CreateRepository <ILockingRepository>()).Returns(lockingRepositoryMockSetup.Object);
            userIdentificationMockSetup.Setup(ui => ui.UserName).Returns("TestUser");
            userIdentificationMock = userIdentificationMockSetup.Object;
            unitOfWorkMock         = unitOfWorkMockSetup.Object;
            contextManager         = new TestContextManager(unitOfWorkMock, unitOfWorkMock);

            RegisterDbSet(servicesDbSet, unitOfWorkMockSetup);
            RegisterDbSet(lockingDbSet, unitOfWorkMockSetup);
        }
Exemplo n.º 12
0
 public LockingManager(IContextManager contextManager, IUserIdentification userIdentification)
 {
     this.contextManager     = contextManager;
     this.userIdentification = userIdentification;
 }
Exemplo n.º 13
0
 public AppEnvironmentDataChecker(IUserIdentification userIdentification, IHttpContextAccessor ctxAccessor, IUserInfoService userInfoService) : base(ctxAccessor)
 {
     this.userInfoService    = userInfoService;
     this.userIdentification = userIdentification;
 }
Exemplo n.º 14
0
 public ResolveManager(IServiceProvider serviceProvider, IUserIdentification userIdentification, ILogger <ResolveManager> logger)
 {
     this.serviceProvider    = serviceProvider;
     this.userIdentification = userIdentification;
     this.logger             = logger;
 }