The system will two types of users. Admins and normal users. Admins can have access to products only. If an admin have access to a product A, it means he also has access to all its sub products.
Normal users can have access to only sub products (one or more).
Screen to add Admin users will have a drop down of products while screen to add users will have a drop down of sub products.
Product Admin will add product sub users.
There is going to be a single table for both Admin users and Normal users as everything else is same for both users.
Please help.
You’re basically looking at this:
Productwill have a self-reference onParentId. If it’s not a sub-category thenParentIdshould beNULL. You’ll want anyone who doesn’t have aSystemRoleof"Admin"defined to be unable to access anyProductthat has aNULLParentId.UserRoleis an association table that provides theM:Nrelationship ofSystemUsertoSystemRole. Even if each user will have a single role it’s a good idea to set up the structure this way for now so your application is easier to expand in the future.