<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to list users with a specific role with Python SDK? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200444#M2713</link>
    <description>&lt;P&gt;i think i just found my own answer &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;users = service.users&lt;BR /&gt;
filtered_users = [x for x in users if 'admin' in x.roles ]&lt;BR /&gt;
for user in filtered_users: print "%s (%s)" % (user.realname, user.roles)&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 08:44:21 GMT</pubDate>
    <dc:creator>asimagu</dc:creator>
    <dc:date>2020-09-29T08:44:21Z</dc:date>
    <item>
      <title>How to list users with a specific role with Python SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200441#M2710</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I am trying to pull a list a users using Python SDK, but only the ones with a specific role.&lt;/P&gt;

&lt;P&gt;I read this documentation &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEJ6#listusers"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEJ6#listusers&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However, I can only get all the users of my system. I was wondering if I could use the component "roles" &lt;/P&gt;

&lt;P&gt;I would only like to list users that have roles=teamA&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 20:40:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200441#M2710</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2016-02-10T20:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to list users with a specific role with Python SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200442#M2711</link>
      <description>&lt;P&gt;Don't see an option in the class definition to filter by role while requesting it. Could you do a filter based on a role after you retrieve all users?? It does return the role (user.role_entities).&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2016 21:11:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200442#M2711</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-10T21:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to list users with a specific role with Python SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200443#M2712</link>
      <description>&lt;P&gt;i have this. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for user in service.users: print "%s (%s)" % (user.realname, user.roles)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and this is the oupput:&lt;/P&gt;

&lt;P&gt;Administrator (['admin'])&lt;BR /&gt;
Amparo Pozi (['power', 'splunk-system-role', 'user'])&lt;BR /&gt;
Amparo Ponno (['admin', 'splunk-system-role', 'user'])&lt;BR /&gt;
Ampario Alaca (['admin', 'power', 'user'])&lt;/P&gt;

&lt;P&gt;How can I filter only the admin users?? &lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 13:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200443#M2712</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2016-02-11T13:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to list users with a specific role with Python SDK?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200444#M2713</link>
      <description>&lt;P&gt;i think i just found my own answer &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;users = service.users&lt;BR /&gt;
filtered_users = [x for x in users if 'admin' in x.roles ]&lt;BR /&gt;
for user in filtered_users: print "%s (%s)" % (user.realname, user.roles)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:44:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-list-users-with-a-specific-role-with-Python-SDK/m-p/200444#M2713</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2020-09-29T08:44:21Z</dc:date>
    </item>
  </channel>
</rss>

