Different Roles for Different Products
-
Hello !
I have one application for which I created a list of roles.
In this application, a user can access several different products, but I would like my user to have some roles when he is accessing product 1, and other roles when accessing product 2.
For now I use entity grants where the permissions are the list of my products to determine in my backend code if the user is allowed to access a product.
But the problem is that if a user has permissions for 2 products, he will have the same list of roles for both products.The best would be to assign to a user, a pair role/product.
Is there a way to do this ?Thank you
-
Why would the roles not work with the product as a prefix and the right as the suffix not work as a role?
I.E.
- product1_read
- product1_write
- product1_delete
- prodcut2_read
- product2_write
- product2_delete
-
@mark-robustelli
It would work, but I was looking for a method to avoid duplicating all the roles as they will be the same for all products.
It would also mean I don't have to parse the role to separate the real role from the concerned product. -
@matthieu , that is understandable. Keep in mind if you are adding a lot of products often, you can use the APIs to help create and manage those permissions.
I.E. Create an Application Role, Create an Entity, Update a User Registration (for updating roles)