Beispiel #1
0
 public IdentityServerDataSeedContributor(
     IClientRepository clientRepository,
     IApiResourceRepository apiResourceRepository,
     IApiScopeRepository apiScopeRepository,
     IIdentityResourceDataSeeder identityResourceDataSeeder,
     IGuidGenerator guidGenerator,
     IPermissionDataSeeder permissionDataSeeder,
     IConfiguration configuration,
     ICurrentTenant currentTenant)
 {
     _clientRepository           = clientRepository;
     _apiResourceRepository      = apiResourceRepository;
     _apiScopeRepository         = apiScopeRepository;
     _identityResourceDataSeeder = identityResourceDataSeeder;
     _guidGenerator        = guidGenerator;
     _permissionDataSeeder = permissionDataSeeder;
     _configuration        = configuration;
     _currentTenant        = currentTenant;
 }
Beispiel #2
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());

            foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
            {
                if (entityType.ClrType.IsAssignableTo(typeof(IMultiTenant)))
                {
                    ICurrentTenant currentTenant = this.GetService <ICurrentTenant>();
                    modelBuilder.Entity(entityType.ClrType).AddQueryFilter <IMultiTenant>(e => e.TenantId == currentTenant.Id);
                }

                if (entityType.ClrType.IsAssignableTo(typeof(ISoftDelete)))
                {
                    modelBuilder.Entity(entityType.ClrType).AddQueryFilter <ISoftDelete>(e => !e.IsDeleted);
                }
            }

            base.OnModelCreating(modelBuilder);
        }
Beispiel #3
0
        public PermissionChecker(
            IOptions <PermissionOptions> options,
            IServiceProvider serviceProvider,
            ICurrentPrincipalAccessor principalAccessor,
            IPermissionDefinitionManager permissionDefinitionManager,
            ICurrentTenant currentTenant)
        {
            PrincipalAccessor           = principalAccessor;
            PermissionDefinitionManager = permissionDefinitionManager;
            CurrentTenant = currentTenant;
            Options       = options.Value;

            _lazyProviders = new Lazy <List <IPermissionValueProvider> >(
                () => Options
                .ValueProviders
                .Select(c => serviceProvider.GetRequiredService(c) as IPermissionValueProvider)
                .ToList(),
                true
                );
        }
Beispiel #4
0
        public DistributedCache(
            IOptions <CacheOptions> cacheOption,
            IOptions <DistributedCacheOptions> distributedCacheOption,
            IDistributedCache cache,
            ICancellationTokenProvider cancellationTokenProvider,
            IDistributedCacheSerializer serializer,
            ICurrentTenant currentTenant)
        {
            _distributedCacheOption = distributedCacheOption.Value;
            _cacheOption            = cacheOption.Value;
            Cache = cache;
            CancellationTokenProvider = cancellationTokenProvider;
            Logger        = NullLogger <DistributedCache <TCacheItem> > .Instance;
            Serializer    = serializer;
            CurrentTenant = currentTenant;

            SyncSemaphore = new SemaphoreSlim(1, 1);

            SetDefaultOptions();
        }
 public NotificationStore(
     IClock clock,
     IObjectMapper objectMapper,
     ICurrentTenant currentTenant,
     IJsonSerializer jsonSerializer,
     IUnitOfWorkManager unitOfWorkManager,
     INotificationRepository notificationRepository,
     IUserSubscribeRepository userSubscribeRepository,
     IUserNotificationRepository userNotificationRepository
     )
 {
     _clock                      = clock;
     _objectMapper               = objectMapper;
     _currentTenant              = currentTenant;
     _jsonSerializer             = jsonSerializer;
     _unitOfWorkManager          = unitOfWorkManager;
     _notificationRepository     = notificationRepository;
     _userSubscribeRepository    = userSubscribeRepository;
     _userNotificationRepository = userNotificationRepository;
 }
Beispiel #6
0
        public AuditingHelper(
            IAuditSerializer auditSerializer,
            IOptions <AbpAuditingOptions> options,
            ICurrentUser currentUser,
            ICurrentTenant currentTenant,
            IClock clock,
            IAuditingStore auditingStore,
            ILogger <AuditingHelper> logger,
            IServiceProvider serviceProvider)
        {
            Options         = options.Value;
            AuditSerializer = auditSerializer;
            CurrentUser     = currentUser;
            CurrentTenant   = currentTenant;
            Clock           = clock;
            AuditingStore   = auditingStore;

            Logger          = logger;
            ServiceProvider = serviceProvider;
        }
 public CmsKitDataSeedContributor(
     IGuidGenerator guidGenerator,
     ICmsUserRepository cmsUserRepository,
     CmsKitTestData cmsKitTestData,
     ICommentRepository commentRepository,
     ReactionManager reactionManager,
     IRatingRepository ratingRepository,
     ICurrentTenant currentTenant,
     IContentRepository contentRepository,
     ITagManager tagManager,
     IEntityTagRepository entityTagRepository,
     IPageRepository pageRepository,
     IBlogRepository blogRepository,
     IBlogPostRepository blogPostRepository,
     IBlogFeatureRepository blogFeatureRepository,
     IEntityTagManager entityTagManager,
     IOptions <CmsKitOptions> options,
     IOptions <CmsKitTagOptions> tagOptions,
     IMediaDescriptorRepository mediaDescriptorRepository,
     IBlobContainer <MediaContainer> mediaBlobContainer)
 {
     _guidGenerator         = guidGenerator;
     _cmsUserRepository     = cmsUserRepository;
     _cmsKitTestData        = cmsKitTestData;
     _commentRepository     = commentRepository;
     _reactionManager       = reactionManager;
     _ratingRepository      = ratingRepository;
     _currentTenant         = currentTenant;
     _contentRepository     = contentRepository;
     _tagManager            = tagManager;
     _entityTagManager      = entityTagManager;
     _entityTagRepository   = entityTagRepository;
     _pageRepository        = pageRepository;
     _blogRepository        = blogRepository;
     _blogPostRepository    = blogPostRepository;
     _blogFeatureRepository = blogFeatureRepository;
     _options    = options;
     _tagOptions = tagOptions;
     _mediaDescriptorRepository = mediaDescriptorRepository;
     _mediaBlobContainer        = mediaBlobContainer;
 }
Beispiel #8
0
 public AppIdentityDataSeeder(
     IGuidGenerator guidGenerator,
     IIdentityRoleRepository roleRepository,
     IIdentityUserRepository userRepository,
     ILookupNormalizer lookupNormalizer,
     IdentityUserManager userManager,
     IdentityRoleManager roleManager,
     ICurrentTenant currentTenant,
     IPermissionDefinitionManager permissionDefinitionManager,
     IPermissionManager permissionManager)
 {
     GuidGenerator               = guidGenerator;
     RoleRepository              = roleRepository;
     UserRepository              = userRepository;
     LookupNormalizer            = lookupNormalizer;
     UserManager                 = userManager;
     RoleManager                 = roleManager;
     CurrentTenant               = currentTenant;
     PermissionDefinitionManager = permissionDefinitionManager;
     PermissionManager           = permissionManager;
 }
 public LinkLoginExtensionGrantValidator(
     ITokenValidator tokenValidator,
     IdentityLinkUserManager identityLinkUserManager,
     ICurrentTenant currentTenant,
     ICurrentUser currentUser,
     IdentityUserManager userManager,
     ICurrentPrincipalAccessor currentPrincipalAccessor,
     IdentitySecurityLogManager identitySecurityLogManager,
     ILogger <LinkLoginExtensionGrantValidator> logger,
     IStringLocalizer <AbpIdentityServerResource> localizer)
 {
     TokenValidator             = tokenValidator;
     IdentityLinkUserManager    = identityLinkUserManager;
     CurrentTenant              = currentTenant;
     CurrentUser                = currentUser;
     UserManager                = userManager;
     CurrentPrincipalAccessor   = currentPrincipalAccessor;
     IdentitySecurityLogManager = identitySecurityLogManager;
     Logger    = logger;
     Localizer = localizer;
 }
 public NotificationDefinitionManager(
     IOptions <NotificationOptions> options,
     IServiceProvider serviceProvider,
     IFeatureChecker featureChecker,
     ICurrentPrincipalAccessor currentPrincipalAccessor,
     IAuthorizationService authorizationService,
     ICurrentTenant currentTenant,
     ICurrentUser currentUser,
     INotificationStore notificationStore
     )
 {
     ServiceProvider          = serviceProvider;
     Options                  = options.Value;
     FeatureChecker           = featureChecker;
     AuthorizationService     = authorizationService;
     CurrentPrincipalAccessor = currentPrincipalAccessor;
     CurrentTenant            = currentTenant;
     CurrentUser              = currentUser;
     NotificationStore        = notificationStore;
     NotificationDefinitions  = new Lazy <IDictionary <string, NotificationDefinition> >(CreateNotificationDefinitions, true);
 }
Beispiel #11
0
 public WeChatPayRefundEventHandler(
     IGuidGenerator guidGenerator,
     ICurrentTenant currentTenant,
     IRefundRepository refundRepository,
     IPaymentManager paymentManager,
     IPaymentRepository paymentRepository,
     IPaymentRecordRepository paymentRecordRepository,
     IRefundRecordRepository refundRecordRepository,
     IWeChatPayFeeConverter weChatPayFeeConverter,
     ServiceProviderPayService serviceProviderPayService)
 {
     _guidGenerator             = guidGenerator;
     _currentTenant             = currentTenant;
     _refundRepository          = refundRepository;
     _paymentManager            = paymentManager;
     _paymentRepository         = paymentRepository;
     _paymentRecordRepository   = paymentRecordRepository;
     _refundRecordRepository    = refundRecordRepository;
     _weChatPayFeeConverter     = weChatPayFeeConverter;
     _serviceProviderPayService = serviceProviderPayService;
 }
Beispiel #12
0
        public PermissionManager(
            IPermissionDefinitionManager permissionDefinitionManager,
            IPermissionGrantRepository permissionGrantRepository,
            IServiceProvider serviceProvider,
            IGuidGenerator guidGenerator,
            IOptions <PermissionManagementOptions> options,
            ICurrentTenant currentTenant)
        {
            GuidGenerator               = guidGenerator;
            CurrentTenant               = currentTenant;
            PermissionGrantRepository   = permissionGrantRepository;
            PermissionDefinitionManager = permissionDefinitionManager;
            Options = options.Value;

            _lazyProviders = new Lazy <List <IPermissionManagementProvider> >(
                () => Options
                .ManagementProviders
                .Select(c => serviceProvider.GetRequiredService(c) as IPermissionManagementProvider)
                .ToList(),
                true
                );
        }
Beispiel #13
0
        public RabbitMqDistributedEventBus(
            IOptions <AbpRabbitMqEventBusOptions> options,
            IConnectionPool connectionPool,
            IRabbitMqSerializer serializer,
            IServiceScopeFactory serviceScopeFactory,
            IOptions <AbpDistributedEventBusOptions> distributedEventBusOptions,
            IRabbitMqMessageConsumerFactory messageConsumerFactory,
            ICurrentTenant currentTenant,
            IEventErrorHandler errorHandler,
            IOptions <AbpEventBusOptions> abpEventBusOptions)
            : base(serviceScopeFactory, currentTenant, errorHandler)
        {
            ConnectionPool                = connectionPool;
            Serializer                    = serializer;
            MessageConsumerFactory        = messageConsumerFactory;
            AbpEventBusOptions            = abpEventBusOptions.Value;
            AbpDistributedEventBusOptions = distributedEventBusOptions.Value;
            AbpRabbitMqEventBusOptions    = options.Value;

            HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> >();
            EventTypes       = new ConcurrentDictionary <string, Type>();
        }
Beispiel #14
0
 public AspNetCoreSecurityLogManager(
     IOptions <AbpSecurityLogOptions> securityLogOptions,
     ISecurityLogStore securityLogStore,
     ILogger <AspNetCoreSecurityLogManager> logger,
     IClock clock,
     ICurrentUser currentUser,
     ICurrentTenant currentTenant,
     ICurrentClient currentClient,
     IHttpContextAccessor httpContextAccessor,
     ICorrelationIdProvider correlationIdProvider,
     IWebClientInfoProvider webClientInfoProvider)
     : base(securityLogOptions, securityLogStore)
 {
     Logger                = logger;
     Clock                 = clock;
     CurrentUser           = currentUser;
     CurrentTenant         = currentTenant;
     CurrentClient         = currentClient;
     HttpContextAccessor   = httpContextAccessor;
     CorrelationIdProvider = correlationIdProvider;
     WebClientInfoProvider = webClientInfoProvider;
 }
 public SampleDataSeedContributor(
     IGuidGenerator guidGenerator,
     ICurrentTenant currentTenant,
     IStoreRepository storeRepository,
     IProductManager productManager,
     IProductRepository productRepository,
     ICategoryManager categoryManager,
     ICategoryRepository categoryRepository,
     IProductCategoryRepository productCategoryRepository,
     ISettingProvider settingProvider,
     IAttributeOptionIdsSerializer attributeOptionIdsSerializer)
 {
     _guidGenerator                = guidGenerator;
     _currentTenant                = currentTenant;
     _storeRepository              = storeRepository;
     _productManager               = productManager;
     _productRepository            = productRepository;
     _categoryManager              = categoryManager;
     _categoryRepository           = categoryRepository;
     _productCategoryRepository    = productCategoryRepository;
     _settingProvider              = settingProvider;
     _attributeOptionIdsSerializer = attributeOptionIdsSerializer;
 }
Beispiel #16
0
    //protected ICorrelationIdProvider CorrelationIdProvider { get; }

    public AuditingFactory(
        IOptions <AuditingOptions> options,
        ICurrentUser currentUser,
        ICurrentTenant currentTenant,
        //ICurrentClient currentClient,
        IClock clock,
        //IAuditingStore auditingStore,
        ILogger <AuditingFactory> logger,
        IServiceProvider serviceProvider
        //ICorrelationIdProvider correlationIdProvider
        )
    {
        Options       = options.Value;
        CurrentUser   = currentUser;
        CurrentTenant = currentTenant;
        //CurrentClient = currentClient;
        Clock = clock;
        //AuditingStore = auditingStore;

        Logger          = logger;
        ServiceProvider = serviceProvider;
        //CorrelationIdProvider = correlationIdProvider;
    }
Beispiel #17
0
 public DefaultPermissionManager(
     IPermissionDefinitionManager permissionDefinitionManager,
     IPermissionStateManager permissionStateManager,
     IPermissionGrantRepository permissionGrantRepository,
     IPermissionStore permissionStore,
     IServiceProvider serviceProvider,
     IGuidGenerator guidGenerator,
     IOptions <PermissionManagementOptions> options,
     ICurrentTenant currentTenant,
     IDistributedCache <PermissionGrantCacheItem> cache)
     : base(
         permissionDefinitionManager,
         permissionStateManager,
         permissionGrantRepository,
         serviceProvider,
         guidGenerator,
         options,
         currentTenant,
         cache)
 {
     ServiceProvider = serviceProvider;
     PermissionStore = permissionStore;
 }
Beispiel #18
0
        public KafkaDistributedEventBus(
            IServiceScopeFactory serviceScopeFactory,
            ICurrentTenant currentTenant,
            IOptions <AbpKafkaEventBusOptions> abpKafkaEventBusOptions,
            IKafkaMessageConsumerFactory messageConsumerFactory,
            IOptions <AbpDistributedEventBusOptions> abpDistributedEventBusOptions,
            IKafkaSerializer serializer,
            IProducerPool producerPool,
            IEventErrorHandler errorHandler,
            IOptions <AbpEventBusOptions> abpEventBusOptions)
            : base(serviceScopeFactory, currentTenant, errorHandler)
        {
            AbpKafkaEventBusOptions       = abpKafkaEventBusOptions.Value;
            AbpDistributedEventBusOptions = abpDistributedEventBusOptions.Value;
            AbpEventBusOptions            = abpEventBusOptions.Value;
            MessageConsumerFactory        = messageConsumerFactory;
            Serializer          = serializer;
            ProducerPool        = producerPool;
            DeadLetterTopicName =
                AbpEventBusOptions.DeadLetterName ?? AbpKafkaEventBusOptions.TopicName + "_dead_letter";

            HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> >();
            EventTypes       = new ConcurrentDictionary <string, Type>();
        }
 public WexinAppService(
     IGuidGenerator guidGenerator,
     IConfiguration configuration,
     IHttpClientFactory httpClientFactory,
     IPasswordHasher <IdentityUser> passwordHasher,
     ICurrentTenant currentTenant,
     ISettingProvider setting,
     WeixinManager weixinManager,
     IdentityUserStore identityUserStore,
     //ICapPublisher capBus,
     IUserClaimsPrincipalFactory <IdentityUser> principalFactory,
     //IdentityServerOptions options,
     IHttpContextAccessor httpContextAccessor,
     //ITokenService TS,
     IUnitOfWorkManager unitOfWorkManager,
     //IAppProvider appProvider
     IOptions <WexinOpenOptions> optionsAccessor,
     ISettingManager settingManager
     )
 {
     ObjectMapperContext = typeof(WeixinModule);
     _guidGenerator      = guidGenerator;
     _configuration      = configuration;
     _httpClientFactory  = httpClientFactory;
     _passwordHasher     = passwordHasher;
     _currentTenant      = currentTenant;
     _setting            = setting;
     _weixinManager      = weixinManager;
     _identityUserStore  = identityUserStore;
     //_capBus = capBus;
     _principalFactory    = principalFactory;
     _httpContextAccessor = httpContextAccessor;
     _unitOfWorkManager   = unitOfWorkManager;
     _options             = optionsAccessor.Value;
     _settingManager      = settingManager;
 }
Beispiel #20
0
    public IdentityClientConfiguration GetClientConfiguration(ICurrentTenant currentTenant, string identityClientName = null)
    {
        if (identityClientName.IsNullOrWhiteSpace())
        {
            identityClientName = IdentityClientConfigurationDictionary.DefaultName;
        }

        if (currentTenant.Id.HasValue)
        {
            var tenantConfiguration = IdentityClients.FirstOrDefault(x => x.Key == $"{identityClientName}.{currentTenant.Id}");
            if (tenantConfiguration.Key == null && !currentTenant.Name.IsNullOrWhiteSpace())
            {
                tenantConfiguration = IdentityClients.FirstOrDefault(x => x.Key == $"{identityClientName}.{currentTenant.Name}");
            }

            if (tenantConfiguration.Key != null)
            {
                return(tenantConfiguration.Value);
            }
        }

        return(IdentityClients.GetOrDefault(identityClientName) ??
               IdentityClients.Default);
    }
 public IdentityPermissionManager(
     IPermissionDefinitionManager permissionDefinitionManager,
     IPermissionStateManager permissionStateManager,
     IPermissionGrantRepository permissionGrantRepository,
     IPermissionStore permissionStore,
     IServiceProvider serviceProvider,
     IGuidGenerator guidGenerator,
     IOptions <PermissionManagementOptions> options,
     ICurrentTenant currentTenant,
     IDistributedCache <PermissionGrantCacheItem> cache,
     IUserRoleFinder userRoleFinder)
     : base(
         permissionDefinitionManager,
         permissionStateManager,
         permissionGrantRepository,
         permissionStore,
         serviceProvider,
         guidGenerator,
         options,
         currentTenant,
         cache)
 {
     UserRoleFinder = userRoleFinder;
 }
 public AccountRepository(IBankingDbContext context, ICurrentTenant currentTenant, ILogger <Account> logger)
 {
     _context       = context;
     _currentTenant = currentTenant;
     _logger        = logger;
 }
Beispiel #23
0
 public TenantFeatureValueProvider(IFeatureStore featureStore, ICurrentTenant currentTenant)
     : base(featureStore)
 {
     CurrentTenant = currentTenant;
 }
Beispiel #24
0
 public FormCustomDataSeedContributor(
     IGuidGenerator guidGenerator, ICurrentTenant currentTenant)
 {
     _guidGenerator = guidGenerator;
     _currentTenant = currentTenant;
 }
 public FileStoringAppServiceTest()
 {
     _currentTenant         = GetRequiredService <ICurrentTenant>();
     _fileStoringAppService = GetRequiredService <IFileStoringAppService>();
     _fileContainerFactory  = GetRequiredService <IFileContainerFactory>();
 }
 public MongoDbRepositoryFilterer(IDataFilter dataFilter, ICurrentTenant currentTenant)
 {
     DataFilter    = dataFilter;
     CurrentTenant = currentTenant;
 }
 public IssueManagementDataSeedContributor(
     IGuidGenerator guidGenerator, ICurrentTenant currentTenant)
 {
     _guidGenerator = guidGenerator;
     _currentTenant = currentTenant;
 }
 public DefaultAzureBlobNameCalculator(ICurrentTenant currentTenant)
 {
     CurrentTenant = currentTenant;
 }
Beispiel #29
0
 protected override void AfterAddApplication(IServiceCollection services)
 {
     _fakeCurrentTenant = Substitute.For <ICurrentTenant>();
     services.AddSingleton(_fakeCurrentTenant);
 }
 public TenantMiddleware(ICurrentTenant currentTenant) => _currentTenant = currentTenant;