Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Configure hangfire with user management system #1308


User avatar
0
soulmate created

Hi,

I am using hangfire for jobs. In my dev environment I can open /dashboard to access my hangfire dashboard. However, in production my admin user does not have access to that page. According to <a class="postlink" href="http://docs.hangfire.io/en/latest/configuration/using-dashboard.html">http://docs.hangfire.io/en/latest/confi ... board.html</a> it is possible to integrate a custom auth system with hangfire. However, I have no clue how to combine the ABP Framework user management system with hangfire. Do you have any idea?


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    As I see, it has documentation about that: <a class="postlink" href="http://docs.hangfire.io/en/latest/configuration/using-dashboard.html#configuring-authorization">http://docs.hangfire.io/en/latest/confi ... horization</a> Have you tried it? We have UseHangfireDashboard in our Startup class: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/App_Start/Startup.cs#L53">https://github.com/aspnetzero/aspnet-ze ... tup.cs#L53</a>

    In your custom IAuthorizationFilter implementation, you can check if current user has a permission for example:

    using (var permissionChecker = IocManager.Instance.ResolveAsDisposable<IPermissionChecker>())
    {
        return permissionChecker.Object.IsGranted(AppPermissions.Pages_Administration)
    }
    
  • User Avatar
    0
    soulmate created

    Thank, that worked!