RBAC - DEFAULT ROUTE -ANGULAR

Discussão em 'Angular' iniciado por no_doubt, Novembro 13, 2024.

  1. no_doubt

    no_doubt Guest

    My application has multiple routes, with one route (e.g., "engagement") set as the default. I am now implementing RBAC for all routes. When all routes except the default are restricted, the application redirects to the default route as expected. However, if the default route itself is restricted, the application logs out. I am doing this in Angular below are my routes.

    {
    path: 'treatment',
    loadComponent: treatment component,
    canActivate: [policyCheckerGuard(Policies.Treatment)],//RBAC check
    data: {
    policyList: [Policies.Treatment],
    },
    },
    {
    path: 'engagement',//default route
    loadComponent:engagement component,
    canActivate: [policyCheckerGuard(Policies.Engagement)],//RBAC check
    data: {
    policyList: [Policies.Engagement],
    },
    },

    { path: '', redirectTo: 'engagement', pathMatch: 'full' },


    What I want is: When I restrict the default route, I want the application to route to the other routes that are not restricted and if no routes are available, the application can be logged off.

    Continue reading...

Compartilhe esta Página