How to create role at runtime?

2
I was wondering if it is possible to create roles at runtime, meaning administrator for example could create roles and assign them to users when the application has been compiled and published.  So far I have tried creating a new entity of type system.userrole and it has not worked properly. Every time I login, the system refreshes the role list to the ones created at design time and therefore all the ones created are lost. Additionally, despite adding them to the userrole table (while viewing the database on SQL Server), it is not possible to choose that role when trying to assign it to a user. Does anyone have any idea how this issue can be resolved? Thanks.
asked
2 answers
2

User Roles are created at design time but are assigned at runtime as part of the startdard Mendix functionality. There could be rare scenario where user roles are so dynamic that they need to be created at runtime. To handle that, you could build your own roles entity and associate that entity will all other entitities. Your access rules at the entity level would then have XPATH expression that would control the access

answered
0

You can’t create roles at runtime, but you can assign the existing roles you created when building the application to new user you’ve created.

https://docs.mendix.com/refguide/user-roles#user-management

Hope this helps.

answered