Esempio n. 1
0
        public ApplicationUserService(IRepositoryFactory repositoryFactory,
                                      IEmployeeService employeeService,
                                      IUserService userService,
                                      IDepartmentService departmentService,
                                      IHttpContextAccessor httpContextAccessor,
                                      IMemoryCache memoryCache,
                                      IProjectService projectService,
                                      IOptions <OnlyOfficeConfig> onlyOfficeOptions)
        {
            _employeeService     = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _userService         = userService ?? throw new ArgumentNullException(nameof(userService));
            _departmentService   = departmentService ?? throw new ArgumentNullException(nameof(departmentService));
            _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
            _memoryCache         = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache));
            _projectService      = projectService ?? throw new ArgumentNullException(nameof(projectService));
            _onlyOfficeOptions   = onlyOfficeOptions.Value;


            //TODO переделать чуть по позже, когда появятся идеи!
            _applicationUser = new ApplicationUser();
            if (httpContextAccessor.HttpContext != null)
            {
                string cacheKey = _httpContextAccessor.HttpContext.User.Identity.Name?.ToLower();
                if (!string.IsNullOrEmpty(cacheKey) && _memoryCache.Get(cacheKey) != null && _memoryCache.Get(cacheKey) is ApplicationUser)
                {
                    _applicationUser = (ApplicationUser)_memoryCache.Get(cacheKey);
                }
                else
                {
                    _applicationUser = Init();
                    _memoryCache.Set(cacheKey, _applicationUser);
                }
            }
        }
Esempio n. 2
0
 public AppPropertyService(IRepositoryFactory repositoryFactory, IOptions <ADConfig> adOptions,
                           IOptions <BitrixConfig> bitrixOptions,
                           IOptions <OnlyOfficeConfig> onlyOfficeOptions, IOptions <TimesheetConfig> timesheetOptions) : base(repositoryFactory)
 {
     _timesheetConfig  = timesheetOptions.Value ?? throw new ArgumentNullException(nameof(timesheetOptions));
     _adConfig         = adOptions.Value ?? throw new ArgumentNullException(nameof(adOptions));
     _bitrixConfig     = bitrixOptions.Value ?? throw new ArgumentNullException(nameof(bitrixOptions));
     _onlyOfficeConfig = onlyOfficeOptions.Value ?? throw new ArgumentNullException(nameof(onlyOfficeOptions));
 }
Esempio n. 3
0
 public OOService(IApplicationUserService applicationUserService, IOptions <OnlyOfficeConfig> ooOptions)
 {
     _applicationUserService = applicationUserService;
     _onlyOfficeConfig       = ooOptions.Value;
 }