14
Views
3
Comments
Implement role based   menu in library inODC
Application Type
Mobile, Reactive

Hello All

I need to create a common menu in Library  in odc and expose the same menu in 4 diffrent apps , the visisbility  of menu will be as per assigned roles for the logged in user .

We are not using ODC roles , but using our custom roles and roles entities.

What could  be the most optimal approach to implement this in ODC.


2025-12-22 13-50-43
Sherif El-Habibi
Champion

Hello, 

If I understand correctly, you’re not using the built-in roles but rather a custom implementation stored in an entity for example, a role like Manager in an entity called Roles. If that’s the case, it’s generally recommended to use the built-in roles for security purposes.

However, if you still prefer using a custom entity, you can create a static entity in a library module that can be shared across the four apps. If the roles entity are subject to frequent changes, it’s better to create a separate app with a normal entity that can also be shared with the other four apps.


2026-01-28 16-57-48
Mihai Melencu
Champion

Hi @Vaibhav Agrawal ,

The most maintainable approach is to keep both the menu component and your custom role model inside the same Library. The menu block can expose an input parameter for the user’s role.

Based on that input, the block can determine which menu items to display, so each user only sees the options allowed by their assigned permissions. 

2024-07-12 05-57-50
Gourav Shrivastava
Champion

Hello @Vaibhav Agrawal 

The optimal approach is:

  1. Create a Web Block (e.g., CommonMenu) in the Library.

  2. Add an Input Parameter (e.g., UserRoles) that accepts the list or structure(if the user has multiple roles) of roles for the logged-in user.

  3. Inside the block, use this input to control menu item visibility — show or hide items based on the provided roles.

  4. In each app, include this menu block and pass the user’s roles from your custom role entity logic to the block input.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.