Jenkins Extensible Choice with user specific items based on users Roles
<p>I have a situation where I would like to alter the contents of a choice parameter in a Jenkins parametrised build.  </p>

<p>In my case I would like one project for deploying the application 'Deploy My App'.  When building this project the user is presented with a choice parameter.  I would like to alter the contents of this list depending on a user role.  i.e. someone with the 'dev_deploy' role will be able to see the dev environments, someone with the 'test_deploy' role will be able to see the test environments etc.</p>

<p>I am currently using the Extensible Choice Parameter plugin and the Role-based Authorization Strategy plugin.</p>

<p>I know that I can write some groovey script to generate the list items for the choice.</p>

<pre><code>def result = ["-------"]

def roles=??????

if(roles.get('dev_deploy') {
    //Add dev environments
    result.add('dev1')
    ....
}
if(roles.get('test_deploy') {
    //Add test environments
    result.add('test1')
    ....
}

return result
</code></pre>

<p>I just can't figure out who to get hold of the users roles?</p>

<p>Anyone know how I might do this, or have different solution to the problem? </p>

<p>Many thanks</p>