Hello everyone. I'm going to make an app where a user can belong to multiple organizations and a user can have different roles/permissions for each organization. Currently available packages like mythauth or ionauth don't have this future. So what is the best way to implement this? what would be the best way to design database tables?
I'm thinking make table structures like this:
- permissions (id, name, display_name)
- roles (id, name, display_name)
- organizations (id, name, address ...)
- users (id, name,email, pass, created_at, updated_at, deleted_at, ...)
- users_permissions (id, user_id, permission_id, organization_id) --- all columns except id are foreign keys
- users_roles (id, user_id, role_id, organization_id) --- all columns except id are foreign keys
Thanks in advance.