Re: Get list of users who has access to a project role

2020-07-22 Thread Jose Diaz
This worked for me on python 3:

from xml.dom import minidom


xmldoc = minidom.parse('config.xml')

roleList = xmldoc.getElementsByTagName('role')

for role in roleList:
roleName = role.attributes['name'].value
print("Role:" + roleName)
userList = role.getElementsByTagName("assignedSIDs")[0].
getElementsByTagName("sid")
for user in userList:
print(user.firstChild.nodeValue)
print()



El martes, 20 de noviembre de 2018, 10:13:02 (UTC+1), LnT escribió:
>
> Thanks to All,
> I found workaround. Written python script, takes input of 
> */config.xml* , parse and get the users. Hope this will 
> help someone like me.
>
> from xml.dom import minidom
>
>
> xmldoc = minidom.parse(*'config.xml'*) 
>
> roleList = xmldoc.getElementsByTagName(*'role'*) 
>
> for role in roleList:
>
> roleName = role.attributes[*'name'*].value
>
> if roleName == *"prj_user_prd"*:
>
> print *"roleName:"*,roleName
>
> userList = role.getElementsByTagName(*"assignedSIDs"*)[0
> ].getElementsByTagName(*"sid"*) 
>
> break 
>
> for user in userList:
>
> print user.firstChild.nodeValue
>
>
> On Tuesday, November 20, 2018 at 12:54:17 AM UTC+5:30, Victor Martinez 
> wrote:
>
>> I have not executed that particular groovy script at all, but based on 
>> the description and name I guess that's something you could use.
>>
>> *How to use the groovy script?*
>>
>>- https://wiki.jenkins.io/display/JENKINS/Scriptler+Plugin
>>
>> That's one way to gather those details.
>>
>> Besides that, I just went through the role-strategy api and found 
>> https://wiki.jenkins.io/display/JENKINS/Role+Strategy+Plugin#RoleStrategyPlugin-Version2.9.0(Aug27,2018)
>>  
>> , I guess, that particular API url might work for your use case, although I 
>> have not tried it
>>
>> Cheers
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2635ba31-19c5-453f-9da9-1edf86d70033o%40googlegroups.com.


Re: Get list of users who has access to a project role

2018-11-20 Thread LnT
Thanks to All,
I found workaround. Written python script, takes input of 
*/config.xml* , parse and get the users. Hope this will help 
someone like me.

from xml.dom import minidom


xmldoc = minidom.parse(*'config.xml'*) 

roleList = xmldoc.getElementsByTagName(*'role'*) 

for role in roleList:

roleName = role.attributes[*'name'*].value

if roleName == *"prj_user_prd"*:

print *"roleName:"*,roleName

userList = role.getElementsByTagName(*"assignedSIDs"*)[0
].getElementsByTagName(*"sid"*) 

break 

for user in userList:

print user.firstChild.nodeValue


On Tuesday, November 20, 2018 at 12:54:17 AM UTC+5:30, Victor Martinez 
wrote:

> I have not executed that particular groovy script at all, but based on the 
> description and name I guess that's something you could use.
>
> *How to use the groovy script?*
>
>- https://wiki.jenkins.io/display/JENKINS/Scriptler+Plugin
>
> That's one way to gather those details.
>
> Besides that, I just went through the role-strategy api and found 
> https://wiki.jenkins.io/display/JENKINS/Role+Strategy+Plugin#RoleStrategyPlugin-Version2.9.0(Aug27,2018)
>  
> , I guess, that particular API url might work for your use case, although I 
> have not tried it
>
> Cheers
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2530c0f3-50af-4628-ba2d-c9db0817daa4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Get list of users who has access to a project role

2018-11-19 Thread Victor Martinez
I have not executed that particular groovy script at all, but based on the 
description and name I guess that's something you could use.

*How to use the groovy script?*

   - https://wiki.jenkins.io/display/JENKINS/Scriptler+Plugin

That's one way to gather those details.

Besides that, I just went through the role-strategy api and found 
https://wiki.jenkins.io/display/JENKINS/Role+Strategy+Plugin#RoleStrategyPlugin-Version2.9.0(Aug27,2018)
 
, I guess, that particular API url might work for your use case, although I 
have not tried it

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/200df9fb-1ec3-4461-be4c-af9988b929f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Get list of users who has access to a project role

2018-11-19 Thread gotviseryon
@Victor - Excuse me here.  I'm kind of new to this stuff.  Could you please 
brief on how to use this groovy script?

On Monday, November 19, 2018 at 7:33:57 AM UTC-5, Victor Martinez wrote:
>
> Might 
> https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/export-role-strategy-permissions-to-csv.groovy
>  
> provide those details?
>
> Cheers
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/05efdafd-413e-4a34-a83c-6f7b4c21fbb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Get list of users who has access to a project role

2018-11-19 Thread Victor Martinez
Might 
https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/export-role-strategy-permissions-to-csv.groovy
 
provide those details?

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c91bdcc4-c254-4339-bd72-c420b46e2a60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Get list of users who has access to a project role

2018-11-19 Thread LnT

Hi -
requirement came up from the audit team , fetch list of users having access 
to production environment Jenkins jobs.
Our Jenkins setup has predefined project roles  and able to see the list of 
users who has access to different environments. since the list of users are 
dynamic and audit is required monthly. Instead fetching the user 
information manually looking at Jenkins ,wish to write an automation script 
.
Tried to access api url  http://<>/role-strategy/api/

Giving 404 Error. Does this mean , jenkins not provided API for urer roles?
Input is required, the best way to get this information - in writing the 
script.

Precisely ,
List of Project Roles are
*PRD-JOB-READ*
*PRD-JOB-RUN*
*PRD-JOB-ADMIN*

Need to fetch the list of users who has access *PRD-JOB-RUN*. Could you 
show somelight

Regards,
LnT

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f6b4b13d-1bca-4bfc-b245-9f2d3d9eec6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.