Iterating through project roles

Description
jriimala
Posts: 2
Joined: Mon Oct 16, 2017 10:03 am

Iterating through project roles

Postby jriimala » Mon Oct 16, 2017 10:30 am

Need help how to read specific project role value from variable. Below function returns mutable Map of IContextId and Collection of roles based on

https://almdemo.polarion.com/polarion/s ... 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($f.id,$prj.getContextId()))

#foreach($r in $role)
$r
#end

Pls provide help with example, thx in advanced.

martins
Posts: 181
Joined: Thu Nov 05, 2009 3:24 pm

Re: Iterating through project roles

Postby martins » Thu Nov 30, 2017 2:16 pm

If you just want to check if a user has a certain role you can do it like this

Code: Select all

#if($role.contains("project_developer"))
   ## code for all project developers
#if($role.contains("project_user"))
   ## code for all project users
#else
   ## code for all other users
#end

Martin


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: tgabor and 2 guests