Skip to content

Commit

Permalink
Fix - Correction de l'authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmugnier committed Nov 30, 2020
1 parent 7437555 commit b004d8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sheaft.Web.Jobs/MyAuthorizationFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public bool Authorize(DashboardContext context)
var httpContext = context.GetHttpContext();

// Allow all authenticated users to see the Dashboard (potentially dangerous).
return httpContext.User.Identity.IsAuthenticated;
return httpContext.User.Identity.IsAuthenticated && (httpContext.User.IsInRole("ADMIN") || httpContext.User.IsInRole("SUPPORT"));
}
}
}
2 changes: 2 additions & 0 deletions Sheaft.Web.Jobs/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Amazon.SimpleEmail;
using AutoMapper;
using Hangfire;
using Hangfire.Dashboard;
using Hangfire.SqlServer;
using IdentityModel;
using MangoPay.SDK;
Expand Down Expand Up @@ -311,6 +312,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IOptions
endpoints.MapHangfireDashboard("", new DashboardOptions
{
AppPath = Configuration.GetValue<string>("Portal:Url"),
Authorization = new List<IDashboardAuthorizationFilter> { new MyAuthorizationFilter() }
});
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
});
Expand Down

0 comments on commit b004d8c

Please sign in to comment.