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
> *<Jenkins-home>/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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/2635ba31-19c5-453f-9da9-1edf86d70033o%40googlegroups.com.