Check for MODULE role?

Hi all, I’m working on a before delete event handler. Right now, I’m wondering if there is a way to pull the user role of the user and check to see if any of their user roles have a specific module role.  The use case would be: we have some user roles that have more administrative abilities. These roles are able to delete fields in situations normal users can’t. Rather than checking for these specific user roles, it would be a great help to look through all their user roles and see if they have the Module.Administrator module role, so that we don’t have to explicitly update the microflow every time the user role definitions change.
2 answers

For that the user role tokens have been created, which you can use in the xpath where retrieving from entity userrole:

This is for every project role. So if you link the project role to your specific module role, it would get you what you need.


You can use the module roles for page- entity-acces etc. within  the module.

In your microflows as Tim also indicates you can only work with the project roles.

But you can also use module-roles for conditional visibility in your pages, so if you make the button invisible for all module-roles except the administrator module role, that should do the trick. See picture below and use “selected roles” in that case. 


But you might also find out you have to rethink your module-role to project-role mapping….