How to manage dynamic menu on the basis of logged in user

Hi,

I am developing a web application. In library layer have defined the theme and templates for the application. In core layer, I have defined entities which also include some master data entities like products and sub products.

Now issue is, application create menu items of product and sub products. Menu is in inside theme which is in library layer. So to create this menu application add dependency of core layer as master data (products and sub products) are in core layer. Other modules of application also use these master data entities. 

Question is where should I keep these master data entities, right now its in core layer but for creating menu theme add dependency, which generate issue of upward references. Should I keep all master data entities in library layer?  Please suggest.

Solution

Hello Vikas,

Hope you're doing well.

As I can see, I think that you have two options for this matter:


Option 1: move your master data to a Library module. For example, creating a ReferenceData_Library module, with those entities and respective actions. This only makes sense if this data doesn't have relation with another core modules and it is something completely isolated. Just to give you an example, I was in a project where we had something similar. Products and sub products were in core layer (because we had business logic associated to them), but we had some entities like countries, zip codes and addresses in the library layer. In your case, I believe it depends if you have business logic associated to those entities or not.


Option 2: move your menu to the core layer. For example, creating a CW (Common Widgets) module with some reusable blocks alongside with the menu. This way you will be able to add a dependency from the menu to the core layer and still have the menu centralized in one location. I would probably go for this one to be honest.


Hope that this helps you!


Kind regards,

Rui Barradas

Solution

Hi Rui,

Thanks for clarification. I think option 2 is more suitable for me as it seems more flexible and clear according to 4 layer architecture.

Regards

Hello Vikas,

Yes, I also believe that option 2 is the best option for your scenario.

Usually, option 1 is used when you have specific data / information with no associated business logic and this data supports multiple non-related applications.


Kind regards,

Rui Barradas