check module role for currentuser

1
Is it possible to get the currentuser his MODULE role in a microflow? Let's say I have a module with 2 roles: Administrator and User. I have a microflow that should be available for both users but based on the user his MODULE role some different actions must be performed in the microflow. Is this possible? Or is the only way create 2 microflows, one for Administrator and one for user?
asked
2 answers
1

Update The solution using two microflows, you mentioned in your question, is definitely the best solutio. Especially if you take module reuse ability into consideration.

I wanted to provide you a solution where everything is in one microflow as you asked and being an alternative to the solution you did mention yourself. It's not elegant at all and you have to make concessions to your module role on microflow level requirement, I agree. :)

Original Answer No this is not possible. A solution is to retrieve a specific role associated to current user, and use that object in a split. This way you are able to execute specific microflow functionality for a specific role.

Retrieve userrole for current user:

[System.UserRoles = $currentUser]
[id = '[%UserRole_MxAdministrator%]']

Add a split which check if the userrole is empty (or not empty).

You are able to use tokens in your XPath (e.g. '[%UserRole_MxAdministrator%]') for user roles defined in your project, as you can see in the code example. Userroles have the 'UserRole' prefix.

answered
1

Hi Roeland. Thanks for your information. I was aware of the solution you described, but in that way, a module is not completely seperated so you can simply use it in another project (or you have to have the exactsame user roles).

I have solved it now by making 2 microflows and set the rights on the microflows for the different module roles.

I hoped it was possible because I'd like to have the amount of microflows that are doing almost the same as low as possible. Maybe in a feature release... :-)

answered