Ejemplo n.º 1
0
 public static void ClearUnused()
 {
     if (_lastClearTime < DateTime.Now.AddMinutes(-15))
     {
         _lastClearTime = DateTime.Now;
         UserContextService.ClearUnused();
     }
 }
Ejemplo n.º 2
0
 public HolidayApprovalWorkflow(
     ILoggerFactory loggerFactory,
     UserContextService userContextService
     )
 {
     this._logger             = loggerFactory.CreateLogger <HolidayApprovalWorkflow>();
     this._userContextService = userContextService;
 }
Ejemplo n.º 3
0
 public HolidayService(
     DomainContext context,
     IWorkflowEngine workflowEngine,
     UserContextService userContext
     )
 {
     this._context        = context;
     this._workflowEngine = workflowEngine;
     this._userContext    = userContext;
 }
Ejemplo n.º 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSession();
            UserContextService.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>());
            app.UseMvc();
        }
Ejemplo n.º 5
0
        public User FindOrCreate()
        {
            var userInfo = UserContextService.GetUserInfo();
            var user     = _userRepository.Get(userInfo.Id);

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

            _userRepository.UseTransaction(() =>
            {
                user = new User(userInfo.Id, userInfo.DisplayName);

                _userRepository.Add(user);
                _userRepository.SaveChanges(); // TODO: should not do this here
            });
            return(user);
        }
Ejemplo n.º 6
0
 public static void GroupMembersAbandon(Guid groupId)
 {
     UserContextService.GroupMembersAbandon(groupId);
 }
Ejemplo n.º 7
0
 public static void Abandon(Guid userId)
 {
     UserContextService.Abandon(userId);
 }
Ejemplo n.º 8
0
        public static void Abandon()
        {
            var key = HttpContext.Current.User.Identity.Name;

            UserContextService.Abandon(key);
        }