Symfony2: Multiple Tenant Roles in FosUserBundle

So, I am renting an application with several clients. In each case, users can access multiple clients with different roles. For example, user A has ROLE_XX for Client C1 , but ROLE_YY for Client C2 .

As far as I know, FosUserBundle stores roles for the user in the roles column (the default table is fos_user ), so this structure is not suitable for my needs.

I read the documentation done using role management , but there is nothing related, so I assume this function is beyond the scope of FosUserBundle ?.

So, I was thinking of creating an extra table that links them (client, user, role), but since I'm not a FOS expert at all, I really don't know if this is correct. Or maybe I missed something. Any feedback is appreciated!

+4
source share
1 answer

Your requirements exceed what Symfony's security role system provides. You need to either support ACLs or encapsulate access control logic in a user security selector. I recently wrote about the latter approach:

http://kriswallsmith.net/post/15994931191/symfony2-security-voters

+5
source

Source: https://habr.com/ru/post/1392520/


All Articles