<?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 How to modify lookup ACL via custom REST in Python? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-modify-lookup-ACL-via-custom-REST-in-Python/m-p/551640#M9865</link>
    <description>&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;(Although this example will use Splunk's Lookup Editor app, it applies to custom REST commands in general.)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I am using the Lookup Editor provided by Splunk from SplunkBase (authored by &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1861"&gt;@LukeMurphey&lt;/a&gt;) and am saving the lookups with the user in context, which saves it as a private user-scoped artifact.&lt;/P&gt;&lt;P&gt;I would like to make it globally shared while retaining the lookup's ownership information, so I attempt the following &lt;A href="https://github.com/LukeMurphey/lookup-editor/blob/e78bf75634281ee668321eb938cb40d60a6453c7/src/bin/lookup_editor/lookupfiles.py#L107" target="_blank" rel="noopener"&gt;after the rest call that saves the lookup&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Set ACL to make lookup globally shared
url = '/servicesNS/%s/%s/data/lookup-table-files/%s/acl' % (owner, namespace, lookup_file)
postargs = {
    'owner': owner, 
    'sharing': 'global'
}

rest.simpleRequest(url, postargs=postargs, sessionKey=key, raiseAllErrors=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using the lookup editor as an admin, it will work fine as the admin has the capabilities to make such modifications; however, users are not able to do so and the call fails.&lt;/P&gt;&lt;P&gt;How can I programmatically make this REST call as an admin? I am hoping that as the script is on the server-side, I won't have to authenticate as an admin as I imagine that would require having to store credentials, which would be tricky as we have several clusters.&lt;/P&gt;&lt;P&gt;I have also tried making the REST call using the Splunk binary as mentioned in &lt;A href="https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335772/highlight/true#M99719" target="_blank" rel="noopener"&gt;this Answer&lt;/A&gt;, but it had no effect.&lt;/P&gt;</description>
    <pubDate>Fri, 14 May 2021 17:50:22 GMT</pubDate>
    <dc:creator>GindiKhangura</dc:creator>
    <dc:date>2021-05-14T17:50:22Z</dc:date>
    <item>
      <title>How to modify lookup ACL via custom REST in Python?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-modify-lookup-ACL-via-custom-REST-in-Python/m-p/551640#M9865</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;(Although this example will use Splunk's Lookup Editor app, it applies to custom REST commands in general.)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I am using the Lookup Editor provided by Splunk from SplunkBase (authored by &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1861"&gt;@LukeMurphey&lt;/a&gt;) and am saving the lookups with the user in context, which saves it as a private user-scoped artifact.&lt;/P&gt;&lt;P&gt;I would like to make it globally shared while retaining the lookup's ownership information, so I attempt the following &lt;A href="https://github.com/LukeMurphey/lookup-editor/blob/e78bf75634281ee668321eb938cb40d60a6453c7/src/bin/lookup_editor/lookupfiles.py#L107" target="_blank" rel="noopener"&gt;after the rest call that saves the lookup&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Set ACL to make lookup globally shared
url = '/servicesNS/%s/%s/data/lookup-table-files/%s/acl' % (owner, namespace, lookup_file)
postargs = {
    'owner': owner, 
    'sharing': 'global'
}

rest.simpleRequest(url, postargs=postargs, sessionKey=key, raiseAllErrors=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using the lookup editor as an admin, it will work fine as the admin has the capabilities to make such modifications; however, users are not able to do so and the call fails.&lt;/P&gt;&lt;P&gt;How can I programmatically make this REST call as an admin? I am hoping that as the script is on the server-side, I won't have to authenticate as an admin as I imagine that would require having to store credentials, which would be tricky as we have several clusters.&lt;/P&gt;&lt;P&gt;I have also tried making the REST call using the Splunk binary as mentioned in &lt;A href="https://community.splunk.com/t5/Splunk-Search/Can-we-create-lookup-table-for-specific-owner/m-p/335772/highlight/true#M99719" target="_blank" rel="noopener"&gt;this Answer&lt;/A&gt;, but it had no effect.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 17:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-modify-lookup-ACL-via-custom-REST-in-Python/m-p/551640#M9865</guid>
      <dc:creator>GindiKhangura</dc:creator>
      <dc:date>2021-05-14T17:50:22Z</dc:date>
    </item>
  </channel>
</rss>

