Welcome Guest, Not a member yet? Register   Sign In
Separate roles/permissions for users belonging to multiple organizations
#1

(This post was last modified: 05-28-2021, 11:59 PM by manager.)

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.
Reply


Messages In This Thread
Separate roles/permissions for users belonging to multiple organizations - by manager - 05-28-2021, 11:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB