Retrieve user in System Groovy Choice Parameter

321 views
Skip to first unread message

Sascha...@t-systems.com

unread,
Oct 24, 2014, 3:09:05 AM10/24/14
to jenkins...@googlegroups.com
Hello Everybody,
 
we need to identify the currently logged-in user in an “Extensible Choice Parameter” with Choice Provider “System Groovy Choice Parameter”. We tried the following:
 
  • User.current()
  • Jenkins.getAuthentication()
  • Build.getCause … which works in a build step but not in an Extensible Choice Parameter
 
We need the user or more exactly the groups the user is member of to calculate what is displayed in the Choice Parameter dropdown. Is there a way to retrieve the user?
 
Thanks & best regards,

Sascha Retter
 
 

Gur Sannikov

unread,
Nov 27, 2014, 2:06:07 AM11/27/14
to jenkins...@googlegroups.com, Sascha...@t-systems.com
Hi, I have a solution for you.
Please try,
return (0).collect{hudson.model.User.current().getDisplayName()};

Sascha...@t-systems.com

unread,
Dec 1, 2014, 3:59:33 AM12/1/14
to gursa...@gmail.com, jenkins...@googlegroups.com

Hi,

 

thank you! That seems to work.

 

Mit freundlichen Grüßen / Best regards

 

Sascha Retter

Reply all
Reply to author
Forward
0 new messages