The right approach to a multi-user type

Hi, We built a project that currently has two panels: panel for admin and panel for users. In the "regular" users there are types, for example: suppliers and organizations. We want to present different pages to each type of user. What is the best way to separate them? Should I create a new panel for each type [for example, a panel for suppliers and a panel for organizations] or is there another more correct way?
5 Replies
awcodes
awcodes6mo ago
Would probably be easier with different panels, that way you won’t have to worry about as many checks to scope data.
_andypeacock
_andypeacock6mo ago
Agreed. I've built my boilerplate around four roles: superadmin (me), tenant owner, tenant staff, and the tenant's customers. I've got 3 panels: one for me, one for tenant owner + staff, one for the tenant's customers. Keep it nice and separated, trust me.
ramclospapp
ramclospappOP6mo ago
Thank you! How is it correct to check in a login that the user actually corresponds to the appropriate panel?
bardolf_6969
bardolf_69696mo ago
I have a single login route that redirects users to the correct panel login based on their role. so all users go to domain.com/login and the route function redirects to admin/login, owner/login, or tennant/login from there
_andypeacock
_andypeacock6mo ago
I do. I've added middleware to A) get the subdomain/domain to identify the tenant, and store the tenant on the request, B) check the user's access to that tenant, and C) check they have access to that panel on that tenant. The reason for the later is that (possibly) a user might have one role in one tenant, and another role in another tenant, and the two roles need different panels in my case. However, you could accomplish the same thing just by showing/hiding navigation items based on user role.
Want results from more Discord servers?
Add your server