diff --git a/Sheaft.Web.Jobs/MyAuthorizationFilter.cs b/Sheaft.Web.Jobs/MyAuthorizationFilter.cs index 1079e6802..0466d8613 100644 --- a/Sheaft.Web.Jobs/MyAuthorizationFilter.cs +++ b/Sheaft.Web.Jobs/MyAuthorizationFilter.cs @@ -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")); } } } diff --git a/Sheaft.Web.Jobs/Startup.cs b/Sheaft.Web.Jobs/Startup.cs index aedc0c59e..fb61cc259 100644 --- a/Sheaft.Web.Jobs/Startup.cs +++ b/Sheaft.Web.Jobs/Startup.cs @@ -8,6 +8,7 @@ using Amazon.SimpleEmail; using AutoMapper; using Hangfire; +using Hangfire.Dashboard; using Hangfire.SqlServer; using IdentityModel; using MangoPay.SDK; @@ -311,6 +312,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IOptions endpoints.MapHangfireDashboard("", new DashboardOptions { AppPath = Configuration.GetValue("Portal:Url"), + Authorization = new List { new MyAuthorizationFilter() } }); endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); });