fix:提供hangfire匿名访问并支持所有权限
This commit is contained in:
parent
1ce016f945
commit
93814112db
@ -10,6 +10,7 @@ using SJZY.Expand.ABP.Core.Prometheus;
|
|||||||
using SJZY.Expand.ABP.Core.Redis;
|
using SJZY.Expand.ABP.Core.Redis;
|
||||||
using SJZY.Expand.ABP.Core.Swagger;
|
using SJZY.Expand.ABP.Core.Swagger;
|
||||||
using SJZY.Track.Application;
|
using SJZY.Track.Application;
|
||||||
|
using SJZY.Track.Application.Hangfire;
|
||||||
using SJZY.Track.Application.HostServices;
|
using SJZY.Track.Application.HostServices;
|
||||||
using SJZY.Track.Repository;
|
using SJZY.Track.Repository;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
@ -80,7 +81,11 @@ public class SjzyTrackApiModule : AbpModule
|
|||||||
app.UseCorsPolicy();
|
app.UseCorsPolicy();
|
||||||
app.UseConfiguredEndpoints();
|
app.UseConfiguredEndpoints();
|
||||||
app.UseAbpSwaggerUI(env);
|
app.UseAbpSwaggerUI(env);
|
||||||
app.UseHangfireDashboard("/hangfire");
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
||||||
|
{
|
||||||
|
DashboardTitle = "轨迹预警任务",
|
||||||
|
Authorization = new[] { new AnonymousHangfireAuthorizationFilter() }
|
||||||
|
});
|
||||||
app.UseAbpSerilogEnrichers();
|
app.UseAbpSerilogEnrichers();
|
||||||
app.UsePrometheus();
|
app.UsePrometheus();
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
using Hangfire.Dashboard;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Hangfire;
|
||||||
|
|
||||||
|
public class AnonymousHangfireAuthorizationFilter : IDashboardAuthorizationFilter
|
||||||
|
{
|
||||||
|
public bool Authorize(DashboardContext context)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user