public static void ClearUnused() { if (_lastClearTime < DateTime.Now.AddMinutes(-15)) { _lastClearTime = DateTime.Now; UserContextService.ClearUnused(); } }
public HolidayApprovalWorkflow( ILoggerFactory loggerFactory, UserContextService userContextService ) { this._logger = loggerFactory.CreateLogger <HolidayApprovalWorkflow>(); this._userContextService = userContextService; }
public HolidayService( DomainContext context, IWorkflowEngine workflowEngine, UserContextService userContext ) { this._context = context; this._workflowEngine = workflowEngine; this._userContext = userContext; }
// 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(); }
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); }
public static void GroupMembersAbandon(Guid groupId) { UserContextService.GroupMembersAbandon(groupId); }
public static void Abandon(Guid userId) { UserContextService.Abandon(userId); }
public static void Abandon() { var key = HttpContext.Current.User.Identity.Name; UserContextService.Abandon(key); }