<?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: Assigning multiple roles to user with Python in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Assigning-multiple-roles-to-user-with-Python/m-p/574212#M10178</link>
    <description>&lt;P class="lia-align-justify"&gt;Hurricane Labs did a sample demo regarding changing user permissions with a dashboard and custom endpoints.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;A href="https://hurricanelabs.com/splunk-tutorials/splunk-custom-endpoints-part-3-posting-the-data/" target="_blank" rel="noopener"&gt;https://hurricanelabs.com/splunk-tutorials/splunk-custom-endpoints-part-3-posting-the-data/&lt;/A&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;I think the endpoint posting is included in part three, video 7 &amp;amp; 8, about cleaning and posting the data to python.&amp;nbsp; This is a good example demo as it needed to be slightly updated in certain parts to work correctly making it a nice tutorial with some trouble shooting involved.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;Aside from that aspect it shows the required format that can be used to send a user name with multiple roles assigned to update the Splunk ACL backend.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;Hopefully this helps solve your issue.&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 14:56:53 GMT</pubDate>
    <dc:creator>jcraumer</dc:creator>
    <dc:date>2021-11-09T14:56:53Z</dc:date>
    <item>
      <title>Assigning multiple roles to user with Python</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Assigning-multiple-roles-to-user-with-Python/m-p/573095#M10177</link>
      <description>&lt;P&gt;I'm writing Python script that assigns multiple roles to a user, but having difficulty understanding what the&amp;nbsp; 'roles' data structure needs to look like. According to the REST documentation for &lt;SPAN class=""&gt;&lt;STRONG&gt;authentication/users/{name}&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;To assign multiple roles, pass in each role using a separate&amp;nbsp;&lt;/SPAN&gt;roles&lt;SPAN&gt;&amp;nbsp;parameter value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For example,&amp;nbsp;&lt;/SPAN&gt;-d roles="role1", -d roles="role2"&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;In Postman, I can successfully construct a request with multiple 'roles' parameters to produce the result I want, which is to assign multiple roles to the user.&amp;nbsp; In Python, my code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(response, content) = h.request(HOST + URL + OUTPUT_MODE, 'POST', headers=HEADERS,                          body=urllib.parse.urlencode({'roles':'admin','roles':'user'}))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the end result is that the user is only assigned the 'user' role, presumably because the 'body' data structure ends up being a dictionary with a single key: &lt;STRONG&gt;{'roles':'user'}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Anybody know what is the right Python data structure to pass to urlencode so that I can add multiple roles to the user in a single POST?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 16:37:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Assigning-multiple-roles-to-user-with-Python/m-p/573095#M10177</guid>
      <dc:creator>datamann119</dc:creator>
      <dc:date>2021-10-31T16:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning multiple roles to user with Python</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Assigning-multiple-roles-to-user-with-Python/m-p/574212#M10178</link>
      <description>&lt;P class="lia-align-justify"&gt;Hurricane Labs did a sample demo regarding changing user permissions with a dashboard and custom endpoints.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&lt;A href="https://hurricanelabs.com/splunk-tutorials/splunk-custom-endpoints-part-3-posting-the-data/" target="_blank" rel="noopener"&gt;https://hurricanelabs.com/splunk-tutorials/splunk-custom-endpoints-part-3-posting-the-data/&lt;/A&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;I think the endpoint posting is included in part three, video 7 &amp;amp; 8, about cleaning and posting the data to python.&amp;nbsp; This is a good example demo as it needed to be slightly updated in certain parts to work correctly making it a nice tutorial with some trouble shooting involved.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;Aside from that aspect it shows the required format that can be used to send a user name with multiple roles assigned to update the Splunk ACL backend.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;Hopefully this helps solve your issue.&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Assigning-multiple-roles-to-user-with-Python/m-p/574212#M10178</guid>
      <dc:creator>jcraumer</dc:creator>
      <dc:date>2021-11-09T14:56:53Z</dc:date>
    </item>
  </channel>
</rss>

