retrieve list of users in jenkins

9,935 views
Skip to first unread message

Naga Rakesh

unread,
Nov 10, 2015, 6:06:17 PM11/10/15
to Jenkins Developers
Hello,

Is there a REST call/ API for retrieving users list who have access to a particular jenkins server? I have searched for a while but couldn't find any.

In short i want to retrieve list of users found at https://<yourjenkins>/configureSecurity/ which shows usernames and their access control, I am aware of the people section at https://<jenkinsurl>/people/api/json but this generates users list even if they don't have access to the jenkins server.

Thanks,
Rakesh

Victor Martinez

unread,
Nov 11, 2015, 3:13:28 AM11/11/15
to Jenkins Developers
Hi Naga,

   If I understood it correctly you can look at the below javadoc:

    For instance, if you run the below groovy script it will show the whole list of users, then you can filter that list to look for any specific access control setup with http://javadoc.jenkins-ci.org/hudson/model/User.html#checkPermission(hudson.security.Permission) 

import hudson.model.User

User.getAll().each { user ->
   println user
}

You can also run  https://<yourjenkins>/asynchPeople/api/xml?depth=1 and filter those users with project 

I hope it helps

Cheers
Reply all
Reply to author
Forward
0 new messages