Creating large number of User roles

1
I have about 50 user roles all having same module roles (about 20 different modules roles) The only difference is name of User roles. Is there any way I can copy one User role 50 times and instead of assigning module role to each User role one by one  just rename each copy of user role to desire user role name? Assigning modules roles to each user role separately is too much time consuming and have risk of error in selection. 
asked
1 answers
0

It sounds to me like you're describing a very common security pattern: you want users of a certain type to only have access to their own data (either personally related to them, for their store, their region, etc.). You do not want 50 user roles that are exactly the same. Instead, you need a role for Admin and a role for Seller.

Here's a simple example. Let's assume your data model has an entity Order and each seller should only see his/her orders. Then Order should have an association to the Account entity which you can configure by opening the Order entity properties and adding an association:


You can then configure the Order entity's security so that an Administrator can see all Orders, but a Seller can only see their own. Note the XPath constraint applied on the Seller's access rule, but not on the Admin:

 

In your app, whenever an Order is created, you should associate it to the correct seller (Account) record. That way, a Seller will have access only to his/her Orders.

This was just a simple example, however I hope it starts to explain the concept. As a next step, I recommend that you learn more by following the Security training paths on gettingstarted.mendix.com.

Hope that helps! Please let us know if you have any questions.

answered