Retrieve User permission to trigger Jenkins Project

9 views
Skip to first unread message

varun vikas

unread,
May 22, 2020, 8:28:43 AM5/22/20
to Jenkins Developers
Hi,

I want to check , if user has access rights to trigger Jenkins project before sending trigger request.
is there any Jenkins rest API available for above task.

I am creating a web portal and i have to use jenkins REST API for above function.

Thanks,
Varun

Markus Winter

unread,
May 23, 2020, 7:00:42 AM5/23/20
to jenkin...@googlegroups.com
Just try to do a HEAD request on the project with the users credentials. If the user has access you should get a 200 return code.
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/e019fdb5-d474-4def-a2ac-9cf855f00de4%40googlegroups.com.

varun vikas

unread,
May 23, 2020, 7:11:55 AM5/23/20
to jenkin...@googlegroups.com
Hi Mark,

Thanks for reply.
Actually I don't know the credential of all users.
I only know the credential of one generic user which will be used to do rest API call.
Is it possible to get permission status of another user by making rest call through a single generic user which credential is known to me.

Thanks,
Varun


Markus Winter

unread,
May 23, 2020, 7:27:03 AM5/23/20
to jenkin...@googlegroups.com
you just need the credential of the user with which you want to trigger the request. not all users.

varun vikas

unread,
May 23, 2020, 7:38:02 AM5/23/20
to jenkin...@googlegroups.com
Hi Markus,

My requirement is that, any user can login on portal and trigger Jenkins build, but in background this request will be sent by a single generic user.
So , I will block the build trigger by any user who does not have Jenkins permission ., So that only those user can trigger builds who have triggere access on Jenkins.
Actually I have credential of only one generic user but on portal any user can trigger build, but I want to get it triggered by only those users who have proper permission.

I have one link ,but read permission API is not given in this link.

Thanks & Regards,
Varun

Markus Winter

unread,
May 23, 2020, 8:45:26 AM5/23/20
to jenkin...@googlegroups.com
I doubt this can be achieved by pure REST API calls.
Probably you need to write your own plugin that provides such a rest api
Reply all
Reply to author
Forward
0 new messages