You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace PeakLims.Resources.HangfireUtilities;using Hangfire.Client;using Hangfire.Common;publicclassCurrentUserFilterAttribute:JobFilterAttribute,IClientFilter{publicvoidOnCreating(CreatingContextcontext){varargue= context.Job.Args.FirstOrDefault(x => x is IJobWithUserContext);if(argue==null)thrownew Exception($"This job does not implement the {nameof(IJobWithUserContext)} interface");varjobParameters= argue as IJobWithUserContext;varuser= jobParameters?.User;if(user==null)thrownew Exception($"A User could not be established");
context.SetJobParameter("User", user);}publicvoidOnCreated(CreatedContextcontext){}}
@@ -0,0+1,23 @@
namespace PeakLims.Resources.HangfireUtilities;using Hangfire.Dashboard;publicclassHangfireAuthorizationFilter:IDashboardAsyncAuthorizationFilter{privatereadonlyIServiceProvider_serviceProvider;publicHangfireAuthorizationFilter(IServiceProviderserviceProvider){_serviceProvider=serviceProvider;}publicTask<bool>AuthorizeAsync(DashboardContextcontext){// TODO alt -- add login handling with cookie handling// var heimGuard = _serviceProvider.GetService<IHeimGuardClient>();// return await heimGuard.HasPermissionAsync(Permissions.HangfireAccess);varenv= _serviceProvider.GetService<IWebHostEnvironment>();return Task.FromResult(env.IsDevelopment());}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Additions and Updates
GetAll
andJob
featuresfake
anymoreBasePaginationParameters
andExceptions
andValueObject
to api project (BasePaginationParameters.cs already exists (when scaffolding multiple bounded contexts) #124)Command
prop from feature scaffoldingFixed
.
in project name (Using some characters in ProjectName breaks generated code #111)Adding Hangfire To an Existing Project
Install
Add this to your Infra Registration
Update
Program.cs
Add queues to your consts
Create the following files
Add a permission to
Permissions
Update your CurrentUserService
Add this to your test fixture
Add this unit test to
CurrentUserServiceTests
This discussion was created from the release v0.23.0.
Beta Was this translation helpful? Give feedback.
All reactions