Skip to content

Commit

Permalink
upd UseHangfireBss (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
iatsuta authored Dec 23, 2024
1 parent 06c470b commit 1594784
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
25 changes: 14 additions & 11 deletions src/Framework.HangfireCore/HangfireExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,27 @@ public static IServiceCollection AddHangfireBss(
public static IApplicationBuilder UseHangfireBss(
this IApplicationBuilder app,
string dashboardUrl = "/admin/jobs",
IDashboardAuthorizationFilter? authorizationFilter = null,
DomainSecurityRule.RoleBaseSecurityRule? dashboardAuthorizationSecurityRule = null)
Action<DashboardOptions>? setupOptions = null)
{
var settings = app.ApplicationServices.GetRequiredService<BssHangfireSettings>();

if (settings.Enabled)
{
var options = new DashboardOptions
{
DashboardTitle = "Regular jobs",
Authorization =
[
new AdminHangfireAuthorization(SecurityRole.Administrator)
],
DisplayNameFunc = (_, job) => settings.GetDisplayName(job)
};

setupOptions?.Invoke(options);

app.UseHangfireDashboard(
dashboardUrl,
new DashboardOptions
{
DashboardTitle = "Regular jobs",
Authorization =
[
authorizationFilter ?? new AdminHangfireAuthorization(dashboardAuthorizationSecurityRule ?? SecurityRole.Administrator)
],
DisplayNameFunc = (_, job) => settings.GetDisplayName(job)
});
options);

settings.RunJobs(app.ApplicationServices);
}
Expand Down
6 changes: 3 additions & 3 deletions src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2009-2024")]

[assembly: AssemblyVersion("22.5.10.0")]
[assembly: AssemblyFileVersion("22.5.10.0")]
[assembly: AssemblyInformationalVersion("22.5.10.0")]
[assembly: AssemblyVersion("22.5.11.0")]
[assembly: AssemblyFileVersion("22.5.11.0")]
[assembly: AssemblyInformationalVersion("22.5.11.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down

0 comments on commit 1594784

Please sign in to comment.