Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cristian9509's avatar

Where to store default roles & permissions?

I have an role based access control with the following schema.

Image

I would have the following permissions: user_edit_profile, user_search, business_edit_profile, business_post, admin_manage_users, admin_manage_posts, dpd_module_access, etc

Roles: Guest_User, Authenticate_User, DPD Module, Business, Administrator.

User Types: Guest, User, Business User, DPD User, Administrator

Examples:

Guest role -> permissions: user_search
...
Dpd Module -> permissions: dpd_module_access

Guest user ->roles: Guest
User user -> roles: Guest, Authenticate_User
DPD User -> roles: Guest, Authenticated_User, Dpd Module

When a user signs up, based on the account they select (user_type), I want to attach the role(S) based on their user type.

Would I do this in the DB by creating another table or something to store default roles? Or put it in the application logic?

Thanks!

0 likes
0 replies

Please or to participate in this conversation.