public TenantAppService(
            IRepository<Tenant, int> repository, 

            TenantManager tenantManager, 
            EditionManager editionManager,
            UserManager userManager,
            
            RoleManager roleManager, 
            IAbpZeroDbMigrator abpZeroDbMigrator, 
            IPasswordHasher<User> passwordHasher
            ) : base(repository)
        {
            _tenantManager = tenantManager; 
            _editionManager = editionManager;
            _roleManager = roleManager;
            _abpZeroDbMigrator = abpZeroDbMigrator;
            _passwordHasher = passwordHasher;
            _userManager = userManager;
        }
Exemplo n.º 2
0
        public TenantRegistrationAppService(
            IMultiTenancyConfig multiTenancyConfig,
            IRecaptchaValidator recaptchaValidator,
            EditionManager editionManager,
            IAppNotifier appNotifier,
            ILocalizationContext localizationContext,
            TenantManager tenantManager,
            ISubscriptionPaymentRepository subscriptionPaymentRepository)
        {
            _multiTenancyConfig            = multiTenancyConfig;
            _recaptchaValidator            = recaptchaValidator;
            _editionManager                = editionManager;
            _appNotifier                   = appNotifier;
            _localizationContext           = localizationContext;
            _tenantManager                 = tenantManager;
            _subscriptionPaymentRepository = subscriptionPaymentRepository;

            AppUrlService = NullAppUrlService.Instance;
        }
Exemplo n.º 3
0
 public UserEmailer(
     IEmailTemplateProvider emailTemplateProvider,
     IEmailSender emailSender,
     IRepository <Tenant> tenantRepository,
     ICurrentUnitOfWorkProvider unitOfWorkProvider,
     IUnitOfWorkManager unitOfWorkManager,
     ISettingManager settingManager,
     EditionManager editionManager,
     UserManager userManager)
 {
     _emailTemplateProvider = emailTemplateProvider;
     _emailSender           = emailSender;
     _tenantRepository      = tenantRepository;
     _unitOfWorkProvider    = unitOfWorkProvider;
     _unitOfWorkManager     = unitOfWorkManager;
     _settingManager        = settingManager;
     _editionManager        = editionManager;
     _userManager           = userManager;
 }
 public TenantAppService(
     
     TenantManager tenantManager,
     UserManager userManager,
     RoleManager roleManager,
     EditionManager editionManager,
     IUnitOfWorkManager unitOfWorkManager,
     IMultiTenancyConfig multiTenancyConfig
     
     )
 {
     _tenantManager = tenantManager;
     _userManager = userManager;
     _roleManager = roleManager;
     _editionManager = editionManager;
     _unitOfWorkManager = unitOfWorkManager;
     _multiTenancyConfig = multiTenancyConfig;
    
 }
 public TenantController(ITenantAppService tenantappservice, 
     
      TenantManager tenantManager,
     UserManager userManager,
     RoleManager roleManager,
     EditionManager editionManager,
     IUnitOfWorkManager unitOfWorkManager,
     IMultiTenancyConfig multiTenancyConfig
     )
 {
     _svcTenant = tenantappservice;
     _roleManager = roleManager;
     _tenantManager = tenantManager;
     _editionManager = editionManager;
     _userManager = userManager;
     _roleManager = roleManager;
     _unitOfWorkManager = unitOfWorkManager;
     _multiTenancyConfig = multiTenancyConfig;
 }
Exemplo n.º 6
0
        public async Task <IActionResult> Assign(string type, string data)
        {
            Dictionary <string, object> Values = null;

            if (type == "edition")
            {
                Values = (await EditionManager.GetFeatureValuesAsync(int.Parse(data))).ToDictionary(o => o.Name, o => (object)o.Value);
            }
            else if (type == "tenant")
            {
                Values = (await TenantManager.GetFeatureValuesAsync(int.Parse(data))).ToDictionary(o => o.Name, o => (object)o.Value);
            }

            var features = FeatureManager.GetAll();

            ViewData["Features"] = features;
            ViewData["Values"]   = Values;
            return(View());
        }
Exemplo n.º 7
0
        /// <summary>
        /// 设置特性
        /// </summary>
        /// <param name="featureSubmitDto"></param>
        /// <returns></returns>
        public virtual async Task SubmitFeature(FeatureSubmitDto featureSubmitDto)
        {
            var allFeatures   = FeatureManager.GetAll();
            var nameValueList = featureSubmitDto.Values.Select(o => new NameValue(o.Key, o.Value)).ToList();

            //前台switch off状态会提交不过来,所以对于不存在的键直接设成空
            foreach (var feature in allFeatures.Where(o => !featureSubmitDto.Values.ContainsKey(o.Name)))
            {
                nameValueList.Add(new NameValue(feature.Name, ""));
            }

            if (featureSubmitDto.Type == "edition")
            {
                await EditionManager.SetFeatureValuesAsync(featureSubmitDto.Data, nameValueList.ToArray());
            }
            else if (featureSubmitDto.Type == "tenant")
            {
                await TenantManager.SetFeatureValuesAsync(featureSubmitDto.Data, nameValueList.ToArray());
            }
        }
 public PaymentController(
     IPaymentAppService paymentAppService,
     ITenantRegistrationAppService tenantRegistrationAppService,
     TenantManager tenantManager,
     EditionManager editionManager,
     IWebUrlService webUrlService,
     ISubscriptionPaymentRepository subscriptionPaymentRepository,
     UserClaimsPrincipalFactory <User, Role> userClaimsPrincipalFactory,
     UserManager userManager,
     SignInManager signInManager)
 {
     _paymentAppService            = paymentAppService;
     _tenantRegistrationAppService = tenantRegistrationAppService;
     _tenantManager  = tenantManager;
     _editionManager = editionManager;
     _webUrlService  = webUrlService;
     _subscriptionPaymentRepository = subscriptionPaymentRepository;
     _userClaimsPrincipalFactory    = userClaimsPrincipalFactory;
     _userManager   = userManager;
     _signInManager = signInManager;
 }
Exemplo n.º 9
0
 public TenantRegistrationController(
     IMultiTenancyConfig multiTenancyConfig,
     TenantManager tenantManager,
     EditionManager editionManager,
     IAppNotifier appNotifier,
     UserManager userManager,
     AbpLoginResultTypeHelper abpLoginResultTypeHelper,
     IRecaptchaValidationService recaptchaValidationService,
     LogInManager logInManager,
     SignInManager signInManager)
 {
     _multiTenancyConfig         = multiTenancyConfig;
     _tenantManager              = tenantManager;
     _editionManager             = editionManager;
     _appNotifier                = appNotifier;
     _userManager                = userManager;
     _abpLoginResultTypeHelper   = abpLoginResultTypeHelper;
     _recaptchaValidationService = recaptchaValidationService;
     _logInManager               = logInManager;
     _signInManager              = signInManager;
 }
Exemplo n.º 10
0
 public TenantAppService(
     IRepository <Tenant, int> repository,
     TenantManager tenantManager,
     EditionManager editionManager,
     UserManager userManager,
     IRepository <User, long> userRepository,
     RoleManager roleManager,
     OrganizationUnitManager orgUnitManager,
     ICacheManager cacheManager,
     IAbpZeroDbMigrator abpZeroDbMigrator
     )
     : base(repository)
 {
     _tenantManager         = tenantManager;
     _editionManager        = editionManager;
     _userManager           = userManager;
     _userRepository        = userRepository;
     _roleManager           = roleManager;
     _orgUnitManager        = orgUnitManager;
     _cacheManager          = cacheManager;
     _abpZeroDbMigrator     = abpZeroDbMigrator;
     LocalizationSourceName = CharonXConsts.LocalizationSourceName;
 }
Exemplo n.º 11
0
        public async Task <string> GetFeatureValueOrNullAsync(int tenantId, string featureName)
        {
            var cacheItem = await GetTenantFeatureCacheItemAsync(tenantId);

            var value = cacheItem.FeatureValues.GetOrDefault(featureName);

            if (value != null)
            {
                return(value);
            }

            if (cacheItem.EditionId.HasValue)
            {
                value = await EditionManager.GetFeatureValueOrNullAsync(cacheItem.EditionId.Value, featureName);

                if (value != null)
                {
                    return(value);
                }
            }

            return(null);
        }
Exemplo n.º 12
0
 public UserEmailer(
     IEmailTemplateProvider emailTemplateProvider,
     IEmailSender emailSender,
     IRepository <Tenant> tenantRepository,
     ICurrentUnitOfWorkProvider unitOfWorkProvider,
     IUnitOfWorkManager unitOfWorkManager,
     ISettingManager settingManager,
     EditionManager editionManager,
     UserManager userManager,
     IAwsEmailSender awsEmailSender,
     IHostingEnvironment env)
 {
     _emailTemplateProvider = emailTemplateProvider;
     _emailSender           = emailSender;
     _tenantRepository      = tenantRepository;
     _unitOfWorkProvider    = unitOfWorkProvider;
     _unitOfWorkManager     = unitOfWorkManager;
     _settingManager        = settingManager;
     _editionManager        = editionManager;
     _userManager           = userManager;
     _awsEmailSender        = awsEmailSender;
     _hostingEnvironment    = env;
     _appConfiguration      = env.GetAppConfiguration();
 }
 public CommonLookupAppService(EditionManager editionManager, IRepository <Lookup> lookupRepository,
                               IRepository <Country> countryRepository, IRepository <Region> regionRepository, IRepository <City> cityRepository,
                               IRepository <Branch> branchRepository, IRepository <Category> categoryRepository,
                               IRepository <ItemClass> itemClassRepository, IRepository <SubCategory> subCategoryRepository,
                               IRepository <ItemPrice> itemPriceRepository, IRepository <Item> itemRepository,
                               IRepository <Corporate> corporateRepository,
                               IRepository <Job> jobRepository,
                               IRepository <ManuFactory> manuFactoryRepository)
 {
     _editionManager        = editionManager;
     _lookupRepository      = lookupRepository;
     _countryRepository     = countryRepository;
     _regionRepository      = regionRepository;
     _cityRepository        = cityRepository;
     _branchRepository      = branchRepository;
     _categoryRepository    = categoryRepository;
     _itemClassRepository   = itemClassRepository;
     _subCategoryRepository = subCategoryRepository;
     _itemPriceRepository   = itemPriceRepository;
     _itemRepository        = itemRepository;
     _corporateRepository   = corporateRepository;
     _jobRepository         = jobRepository;
     _manuFactoryRepository = manuFactoryRepository;
 }
Exemplo n.º 14
0
        public TenantManager(
            IRepository <Tenant> tenantRepository,
            IRepository <TenantFeatureSetting, long> tenantFeatureRepository,
            EditionManager editionManager,
            IUnitOfWorkManager unitOfWorkManager,
            RoleManager roleManager,
            //IUserEmailer userEmailer,
            //TenantDemoDataBuilder demoDataBuilder,
            UserManager userManager,
            INotificationSubscriptionManager notificationSubscriptionManager,
            //IAppNotifier appNotifier,
            IAbpZeroFeatureValueStore featureValueStore,
            IAbpZeroDbMigrator abpZeroDbMigrator,
            IPasswordHasher <User> passwordHasher,

            IRepository <SubscribableEdition> subscribableEditionRepository) : base(
                tenantRepository,
                tenantFeatureRepository,
                editionManager,
                featureValueStore
                )
        {
            AbpSession = NullAbpSession.Instance;

            _unitOfWorkManager = unitOfWorkManager;
            _roleManager       = roleManager;
            //_userEmailer = userEmailer;
            //_demoDataBuilder = demoDataBuilder;
            _userManager = userManager;
            _notificationSubscriptionManager = notificationSubscriptionManager;
            //_appNotifier = appNotifier;
            _abpZeroDbMigrator = abpZeroDbMigrator;
            _passwordHasher    = passwordHasher;

            _subscribableEditionRepository = subscribableEditionRepository;
        }
Exemplo n.º 15
0
 public TenantManager(
     IRepository <Tenant> tenantRepository,
     IRepository <TenantFeatureSetting, long> tenantFeatureRepository,
     EditionManager editionManager,
     IUnitOfWorkManager unitOfWorkManager,
     RoleManager roleManager,
     UserManager userManager,
     INotificationSubscriptionManager notificationSubscriptionManager,
     IAppNotifier appNotifier,
     IAbpZeroFeatureValueStore featureValueStore,
     IAbpZeroDbMigrator abpZeroDbMigrator)
     : base(
         tenantRepository,
         tenantFeatureRepository,
         editionManager,
         featureValueStore)
 {
     _unitOfWorkManager = unitOfWorkManager;
     _roleManager       = roleManager;
     _userManager       = userManager;
     _notificationSubscriptionManager = notificationSubscriptionManager;
     _appNotifier       = appNotifier;
     _abpZeroDbMigrator = abpZeroDbMigrator;
 }
Exemplo n.º 16
0
 public CommonLookupAppService(EditionManager editionManager)
 {
     _editionManager = editionManager;
 }
Exemplo n.º 17
0
 public TenantAppService(TenantManager tenantManager, RoleManager roleManager, EditionManager editionManager)
 {
     _tenantManager  = tenantManager;
     _roleManager    = roleManager;
     _editionManager = editionManager;
 }
Exemplo n.º 18
0
 public CustomEditionManager(EditionManager editionManager, TenantManager tenantManager)
 {
     _editionManager = editionManager;
     _tenantManager  = tenantManager;
 }
Exemplo n.º 19
0
 public TenantAppService(TenantManager tenantManager, RoleManager roleManager, EditionManager editionManager, IRepository <Tenant> tenantRepository)
 {
     _tenantManager    = tenantManager;
     _roleManager      = roleManager;
     _editionManager   = editionManager;
     _tenantRepository = tenantRepository;
 }
 public EditionAndFeature_Tests()
 {
     _editionManager = Resolve <EditionManager>();
     _tenantManager  = Resolve <TenantManager>();
     _featureChecker = Resolve <FeatureChecker>();
 }
Exemplo n.º 21
0
        /// <summary>
        /// 微信端注册提交
        /// </summary>
        /// <param name="registerDto"></param>
        /// <returns></returns>
        public virtual async Task Register(RegisterDto registerDto)
        {
            var tenant = new Tenant(registerDto.CompanyName, registerDto.TenancyName);

            //var defaultEdition = await _editionManager.FindByNameAsync(EditionManager.DefaultEditionName);
            //if (defaultEdition != null)
            //{
            //    tenant.EditionId = defaultEdition.Id;
            //}

            await TenantManager.InsertAsync(tenant);

            await CurrentUnitOfWork.SaveChangesAsync(); // To get new tenant's id.

            tenant.SetPropertyValue("Mobile", registerDto.Mobile);
            tenant.SetPropertyValue("PersonName", registerDto.Name);

            //如果是被邀请进来的,则设置邀请人id
            if (registerDto.Inviter.HasValue)
            {
                Logger.Info("设置邀请信息");
                tenant.SetPropertyValue("Inviter", registerDto.Inviter.Value);
                //邀请进来的默认激活
                await MESTenantManager.SetActive(tenant.Id, true);

                var edition_processor = await EditionManager.GetAll().Where(o => o.Name == "JIAGONGDIANJICHUBAN").SingleOrDefaultAsync(); //加工点版本

                var edition_customer = await EditionManager.GetAll().Where(o => o.Name == "KEHUJICHUBAN").SingleOrDefaultAsync();         //客户版本

                //默认加工点版本
                if (edition_processor != null)
                {
                    tenant.EditionId = edition_processor.Id;
                }


                if (!string.IsNullOrEmpty(registerDto.InviterUnitName))
                {
                    var unit = await UnitManager.GetAll().Where(o => o.TenantId == registerDto.Inviter.Value && o.UnitName == registerDto.InviterUnitName)
                               .FirstOrDefaultAsync();

                    if (unit != null)
                    {
                        //设置默认版本
                        if (unit.UnitNature == UnitNature.客户 && edition_customer != null)
                        {
                            tenant.EditionId = edition_customer.Id;
                        }
                    }

                    //绑定新注册账号至邀请人的往来单位
                    await BindTenantToUnitName(tenant.Id, registerDto.Inviter.Value, registerDto.InviterUnitName);
                }
            }
            // We are working entities of new tenant, so changing tenant filter
            using (CurrentUnitOfWork.SetTenantId(tenant.Id))
            {
                // Create static roles for new tenant
                await RoleManager.CreateStaticRoles(tenant.Id);

                await CurrentUnitOfWork.SaveChangesAsync(); // To get static role ids

                // Grant all permissions to admin role
                var adminRole = RoleManager.GetAll().Where(r => r.Name == StaticRoleNames.Tenants.Admin).Single();
                await RoleManager.GrantAllPermissionsAsync(adminRole);

                // Create admin user for the tenant
                var adminUser = await CreateTenantAdminUser(tenant.Id, registerDto);

                //设置管理用户有接收外协提醒的权限
                adminUser.SetStatus(MESStatusNames.ReceiveOuterTask);
                // Assign admin user to role!
                await UserManager.SetRoles(adminUser, new int[] { adminRole.Id });

                await CurrentUnitOfWork.SaveChangesAsync();
            }
        }
Exemplo n.º 22
0
 public TenantAppService(TenantManager tenantManager, RoleManager roleManager, EditionManager editionManager)
 {
     _tenantManager = tenantManager;
     _roleManager = roleManager;
     _editionManager = editionManager;
 }
Exemplo n.º 23
0
 public TenantManager(EditionManager editionManager, IRepository <Tenant> tenantRepository, IRepository <TenantFeatureSetting, long> tenantFeatureRepository)
     : base(tenantRepository, tenantFeatureRepository, editionManager)
 {
 }
Exemplo n.º 24
0
 public TenantManager(EditionManager editionManager)
     : base(editionManager)
 {
 }
Exemplo n.º 25
0
 public EditionAppService(EditionManager editionManager)
 {
     _editionManager = editionManager;
 }
 public CommonLookupAppService(EditionManager editionManager, IRepository <User, long> userRepository)
 {
     _editionManager = editionManager;
     _userRepository = userRepository;
 }
Exemplo n.º 27
0
 public TenantAppService(IRepository <Order> orderRepository, IRepository <Product> productRepository, EditionManager editionManager, TenantManager tenantManager, IRoleAppService roleAppService, RoleManager roleManager, UserManager userManager, IApiKeyService apiKeyService, IRepository <Districts> districtRepository, IImageGenerator imageGenerator)
 {
     _orderRepository    = orderRepository;
     _productRepository  = productRepository;
     _editionManager     = editionManager;
     _tenantManager      = tenantManager;
     _roleAppService     = roleAppService;
     _roleManager        = roleManager;
     _userManager        = userManager;
     _apiKeyService      = apiKeyService;
     _districtRepository = districtRepository;
     _imageGenerator     = imageGenerator;
 }
Exemplo n.º 28
0
 public EditionAndFeatureTests()
 {
     editionManager = Resolve <EditionManager>();
     tenantManager  = Resolve <TenantManager>();
     featureChecker = Resolve <FeatureChecker>();
 }
Exemplo n.º 29
0
 public FeatureService(EditionManager editionManager, TenantManager tenantManager, IRepository <Edition> editionRepository)
 {
     _editionManager    = editionManager;
     _tenantManager     = tenantManager;
     _editionRepository = editionRepository;
 }