Open Closed

How to hide User Menu Items? #8785


User avatar
0
abhisheksreesaila created

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: v9.0.3
  • UI Type: Blazor Server
  • Database System: EF Core ( PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): No
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Background: I have a following a modular monolith style of developing an application. I have 2 modules apart from Main app.

I am trying to hide the linked accounts, sessions, account delegation etc. Followed the instructions here but did not work. See my screenshots https://abp.io/support/questions/3741/Linked-accounts-in-header-bar

But when i navigate to **session **page - it is not there which is good. Question: Why does it show up when I navigate to other pages + How i can switch it off on all pages?

Code Added

Permissions

Does not hide in the main page

Hiding in the session page

Even tried using leptonX theme


7 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello,

    To reproduce the problem I created a Blazor Server project and did what you did. In my case it worked. In this case I think the problem is caused by the dependencies of your modules and host application. If your modules depend on the account module but you don't really need it, you can remove them. Similarly, such repetitive dependencies on both sides should be removed. The end application already depends on them and it should be its responsibility to manage this dependency.

  • User Avatar
    0
    abhisheksreesaila created

    Thats what i thought. I am not able to find that dependency. Check my screenshots.

    Main

    Modules

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hello,

    Thank you for providing detailed information. In order to minimize the surface of the problem, could you first try to unplug both of your modules from the Host application and try to reproduce the problem? If the problem does not persist, can you add the modules one by one and try again so that we can understand which module or host application is causing the problem.

  • User Avatar
    0
    abhisheksreesaila created

    got it! let me try that and get back to you!

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Okay, I'm waiting to hear from you.

  • User Avatar
    0
    abhisheksreesaila created

    Ok, I found the issue.

    ---- this code

    if (context.Menu.Name == StandardMenus.User || context.Menu.Name == StandardMenus.Shortcut) { var LinkedAccounts = context.Menu.GetMenuItemOrNull("Account.LinkedAccounts"); LinkedAccounts?.RequirePermissions(FinxplorerPermissions.UserMenu.LinkedAccounts); }

    was inside if (context.Menu.Name == StandardMenus.Main) { await ConfigureMainMenuAsync(context); }

    So it was never called to remove it. now, placed it outside.

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Great, now that the problem is solved, I'll close this question,

    You can open a new question at any time.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 20, 2025, 18:00