0
deltavision created
Hi,
using: Core, MVC, jQuery project - v7.2.2
Reference to #5755 - Specific the last comment.
We have a Hangfire job that is run for each tenant. When in UnitOfWork for the specific tenant - call to methods that are authorized fails (No user logged in)
- As suggested in #5755 - run a job as a user or role?
- "Disable" authorized check for hangfire job called through host.
3 Answer(s)
-
0
hi
You can refer to this reply. https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1107#issuecomment-226714736
-
0
Hi maliming
thank you - we have done it with the code below. To avoid "breaking" exsisting use of AppServices - we created a "HangfireUser" in each tenant, with the relevant roles/rights.
var tenants = _tenantRepository.GetAll(); foreach(var tenant in tenants) { using (CurrentUnitOfWork.SetTenantId(tenant.Id)) { if (_featureChecker.IsEnabled(tenant.Id, AppFeatures.XYZ)) { var tenantUser = _userManager.Users.FirstOrDefault(u => u.UserName.ToUpper() == "HangfireUser"); if (tenantUser != null) { using (_abpSession.Use(tenant.Id, tenantUser.Id)) { // DO PROCESS...
-
0
NB: also reference to #4115