示例#1
0
        public CodeZeroUserManager(
            CodeZeroRoleManager <TRole, TUser> roleManager,
            CodeZeroUserStore <TRole, TUser> store,
            IOptions <IdentityOptions> optionsAccessor,
            IPasswordHasher <TUser> passwordHasher,
            IEnumerable <IUserValidator <TUser> > userValidators,
            IEnumerable <IPasswordValidator <TUser> > passwordValidators,
            ILookupNormalizer keyNormalizer,
            IdentityErrorDescriber errors,
            IServiceProvider services,
            ILogger <UserManager <TUser> > logger,
            IPermissionManager permissionManager,
            IUnitOfWorkManager unitOfWorkManager,
            ICacheManager cacheManager,
            IRepository <OrganizationUnit, long> organizationUnitRepository,
            IRepository <UserOrganizationUnit, long> userOrganizationUnitRepository,
            IOrganizationUnitSettings organizationUnitSettings,
            ISettingManager settingManager)
            : base(
                store,
                optionsAccessor,
                passwordHasher,
                userValidators,
                passwordValidators,
                keyNormalizer,
                errors,
                services,
                logger)
        {
            _permissionManager              = permissionManager;
            _unitOfWorkManager              = unitOfWorkManager;
            _cacheManager                   = cacheManager;
            _organizationUnitRepository     = organizationUnitRepository;
            _userOrganizationUnitRepository = userOrganizationUnitRepository;
            _organizationUnitSettings       = organizationUnitSettings;
            _settingManager                 = settingManager;
            _optionsAccessor                = optionsAccessor;

            CodeZeroStore = store;
            RoleManager   = roleManager;
        }
        protected CodeZeroUserManager(
            CodeZeroUserStore <TRole, TUser> userStore,
            CodeZeroRoleManager <TRole, TUser> roleManager,
            IPermissionManager permissionManager,
            IUnitOfWorkManager unitOfWorkManager,
            ICacheManager cacheManager,
            IRepository <OrganizationUnit, long> organizationUnitRepository,
            IRepository <UserOrganizationUnit, long> userOrganizationUnitRepository,
            IOrganizationUnitSettings organizationUnitSettings,
            ILocalizationManager localizationManager,
            IdentityEmailMessageService emailService,
            ISettingManager settingManager,
            IUserTokenProviderAccessor userTokenProviderAccessor)
            : base(userStore)
        {
            CodeZeroStore       = userStore;
            RoleManager         = roleManager;
            LocalizationManager = localizationManager;
            _settingManager     = settingManager;

            _permissionManager              = permissionManager;
            _unitOfWorkManager              = unitOfWorkManager;
            _cacheManager                   = cacheManager;
            _organizationUnitRepository     = organizationUnitRepository;
            _userOrganizationUnitRepository = userOrganizationUnitRepository;
            _organizationUnitSettings       = organizationUnitSettings;

            CodeZeroSession = NullCodeZeroSession.Instance;

            UserLockoutEnabledByDefault          = true;
            DefaultAccountLockoutTimeSpan        = TimeSpan.FromMinutes(5);
            MaxFailedAccessAttemptsBeforeLockout = 5;

            EmailService = emailService;

            UserTokenProvider = userTokenProviderAccessor.GetUserTokenProviderOrNull <TUser>();
        }