Open Closed

Hide Linked Accounts, Authority delegation etc in Angular #7013


User avatar
1
franciscokadzi@gmail.com created
  • ABP Framework version: v7.4.2
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I need to hide the following options on the user menu.

  • Linked Accounts
  • Authority delegation

I don't want to disable the feature since I will use it in a future edition.

I also want to hide these menu items.

  • Text Templates
  • Language Management

I have tried using feature management to disable these features. But my application is a multitenant application and it does not get disabled for every tenant. Besides, the goal is to just hide these menus for admins of all tenants not to disable it.

I have already tried these but could not get it to work https://docs.abp.io/en/abp/latest/UI/Angular/Modifying-the-Menu#how-to-patch-or-remove-a-navigation-element https://docs.abp.io/en/abp/latest/UI/Angular/Modifying-the-Menu#how-to-patch-or-remove-an-right-part-element

Can you please help with the steps to get these done


7 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    To hide menu temporarily like Text Templates and Language Management you may comment them in app.module.ts just like

    it will result like

    thanks

  • User Avatar
    0
    franciscokadzi@gmail.com created

    Thanks for the response.

    How about Linked Accounts, authenticator app and Authority delegation

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    please check similar issue https://support.abp.io/QA/Questions/3741/Linked-accounts-in-header-bar if it helps you.

    Thanks

  • User Avatar
    1
    franciscokadzi@gmail.com created

    Yes I have seen this issue ealier. It assumes the UI is MVC. My UI is angular. Do you mean to say I have to create a new menucontributor in my HttpApi.Host project? Secondly in my case I do not seek to use permissions to hide or show the menus. I just want to hide it by default.

  • User Avatar
    0
    yusuf.cirak created
    Angular Developer

    Hi,

    You can hide menu items.

    https://docs.abp.io/en/abp/latest/UI/Angular/Modifying-the-Menu#how-to-patch-or-remove-a-navigation-element

    We're sorry to keep you waited. I will leave some code examples.

    Authority Delegation and Linked Accounts are under user menu items which handled by UserMenuService so you need to do this:

    const HIDDEN_MENU_ITEMS_PROVIDER = [
      {
        provide: APP_INITIALIZER,
        useFactory: () => {
          const userMenu = inject(UserMenuService);
          return () => {
            const obj = { visible: () => false };
            userMenu.patchItem(eUserMenuItems.AuthorityDelegation, obj);
            userMenu.patchItem(eUserMenuItems.LinkedAccounts, obj);
          };
        },
        multi: true,
      },
    ];
    

    The same should apply for Authenticator App. You need to import ManageProfileTabsService from @volo/abp.ng.account package. You can use eAccountManageProfileTabNames enum type.

  • User Avatar
    0
    gogu.stere@3sstudio.com created

    Thanks for the response, managed to modify the userMenu items, but i can't find how to hide/delete filter menu option in the sidemenu. Any topic that i should check?

  • User Avatar
    0
    yusuf.cirak created
    Angular Developer

    Hi,

    You can check this documentation.

    For example, i can hide the Administration tab with this code.

    const HIDDEN_ROUTES_PROVIDER = [
      {
        provide: APP_INITIALIZER,
        useFactory: (routesService: RoutesService) => {
          return () => {
            const obj = { invisible: true };
            routesService.patch(eThemeSharedRouteNames.Administration, obj);
          };
        },
        deps: [RoutesService],
        multi: true,
      },
    ];
    
    • Use eLanguageManagementRouteNames.LanguageManagement from @volo/abp.ng.language-management
    • Use eTextTemplateManagementRouteNames.TextTemplates from @volo/abp.ng.text-template-management
Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19