Page 1 of 1

Iterating through project roles

Posted: Mon Oct 16, 2017 10:30 am
by jriimala
Need help how to read specific project role value from variable. Below function returns mutable Map of IContextId and Collection of roles based on ... textId...-

Trying to find out, if variable has project_assignable role in it and if so then doing something.

In this case variable can have project_user project_assignable project_reviewer project_approver in it, but would like to learn how to iterate $r variable so that I could check specific value from it.

#set($role = $securityService.getContextRolesForUser($,$prj.getContextId()))

#foreach($r in $role)

Pls provide help with example, thx in advanced.

Re: Iterating through project roles

Posted: Thu Nov 30, 2017 2:16 pm
by martins
If you just want to check if a user has a certain role you can do it like this

Code: Select all

   ## code for all project developers
   ## code for all project users
   ## code for all other users