fetching users in microflow based on module role

Hi, I have an event that different users can relate differently to, and these are questions about access to common generic entities. As an example: In a marathon there are in general 3 given roles. Organizers, runners and spectators. At each marathon they have their set roles but at another marathon they can have another role. I am trying to build a module with a general database module where access only is allowed through user and module roles. Another problem is that once the organizer does something that should be updated for either or both the runners and spectators it will be put in a process queue and executed by the system which does not have a user.   I learnt (here https://community.mendix.com/link/questions/8361) yesterday that I can do xpaths to get which users have a certain user role with a path looking similar to this: [Administration.Account/System.UserRoles = '[%UserRole_Runner%]'] Is there anything similar to match for Module roles? The next question is: can I conditionally assign User/Module roles depending on event?   Kind regards Johan  
1 answers

As far as I know, you cannot change Moduleroles dynamically. 
For userroles, you can set those for users in a running application. Just retrieve the desired role from the Database and add it to the the User (or remove it). But I think, the changes will only take effect, after the user has logged out and logged in again.  

If I understand you correctly, it looks like you want to build something similar to a Multitenant App. 

Maybe this helps: https://docs.mendix.com/howto/security/set-up-your-first-multi-tenant-app