Open Closed

Lepton X hide menu from other micro service #5011


User avatar
0
andmattia created
  • ABP Framework version: v7.1.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes

I've move my solution to LeptonX.

So I've created a second microservice and my angular UI has a new menu but the root name still visible to all user "autenticated" and "not autehnticated".

How can set my second menu visibile only for auth user?

I try to change my routing.module.ts inside a microservice folder off angular app but base menu name still visible

{
    path: '',
    pathMatch: 'full',
    component: DynamicLayoutComponent,
    children: [],
    canActivate: [
      AuthGuard,
      PermissionGuard
    ],
  },

1 Answer(s)
  • User Avatar
    0
    masum.ulu created
    Support Team Angular Expert

    Hi andmattia, Your code just prevent go to link not hide item from menu, you need to set permission or create new condition for visiblity of route item for example

    function configureRoutes(routesService: RoutesService) {
      const config = inject(ConfigStateService);
      const isHost = config.getOne('currentUser').roles.includes('host');
    
      return () => {
        routesService.add([
          {
            path: '/identity',
            name: '::Menu:IdentityManagement',
            iconClass: 'fas fa-users',
            order: 2,
            layout: eLayoutType.application,
            
            //This
            invisible: isHost,
            //Or this
            requiredPolicy: 'AbpIdentity.Roles',
          },
        ]);
      };
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09