<?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 Modifying saved search permissions using the python SDK in Security</title>
    <link>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194736#M5713</link>
    <description>&lt;P&gt;I'm trying to modify a saved search's permissions using the python SDK and I'm running into problems.  Basically I'm not sure how to actually do it or if it's even possible.  I can see these settings just fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;try:
    service = initSplunk() # Returns a client.connect object
except:
    print "Couldn't get a connection"
    exit(1)

for saved_search in service.saved_searches:
    access = saved_search.access
    print"[%s]" % saved_search.name

    for key in access:
        print "   %s = %s" % (key , access[key])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I run this bit of code on my local splunk install, it prints out the access settings for my one saved search "test_search":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test_search]
   can_change_perms = 1
   sharing = user
   can_share_global = 1
   app = webtest
   modifiable = 1
   can_list = 1
   can_share_user = 1
   can_share_app = 1
   perms = None
   removable = 1
   can_write = 1
   owner = admin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is, saved_search.access is a splunklib.data.Record which doesn't seem to have any sort of update function.  If I try to use saved_search.update, it doesn't recognize "access".  I'm not sure if I'm just using the wrong key words here or if this is impossible to do.&lt;/P&gt;

&lt;P&gt;Thanks for the assistance! &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 16:49:40 GMT</pubDate>
    <dc:creator>erichar7</dc:creator>
    <dc:date>2020-09-28T16:49:40Z</dc:date>
    <item>
      <title>Modifying saved search permissions using the python SDK</title>
      <link>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194736#M5713</link>
      <description>&lt;P&gt;I'm trying to modify a saved search's permissions using the python SDK and I'm running into problems.  Basically I'm not sure how to actually do it or if it's even possible.  I can see these settings just fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;try:
    service = initSplunk() # Returns a client.connect object
except:
    print "Couldn't get a connection"
    exit(1)

for saved_search in service.saved_searches:
    access = saved_search.access
    print"[%s]" % saved_search.name

    for key in access:
        print "   %s = %s" % (key , access[key])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I run this bit of code on my local splunk install, it prints out the access settings for my one saved search "test_search":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test_search]
   can_change_perms = 1
   sharing = user
   can_share_global = 1
   app = webtest
   modifiable = 1
   can_list = 1
   can_share_user = 1
   can_share_app = 1
   perms = None
   removable = 1
   can_write = 1
   owner = admin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is, saved_search.access is a splunklib.data.Record which doesn't seem to have any sort of update function.  If I try to use saved_search.update, it doesn't recognize "access".  I'm not sure if I'm just using the wrong key words here or if this is impossible to do.&lt;/P&gt;

&lt;P&gt;Thanks for the assistance! &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:49:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194736#M5713</guid>
      <dc:creator>erichar7</dc:creator>
      <dc:date>2020-09-28T16:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying saved search permissions using the python SDK</title>
      <link>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194737#M5714</link>
      <description>&lt;P&gt;Did you find any solution, I am trying to do the same using java. I could add to the variable, but unable to update it.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jul 2014 00:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194737#M5714</guid>
      <dc:creator>abhijitmishra</dc:creator>
      <dc:date>2014-07-01T00:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying saved search permissions using the python SDK</title>
      <link>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194738#M5715</link>
      <description>&lt;P&gt;Unfortunately, I haven't found a solution yet&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jul 2014 15:56:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194738#M5715</guid>
      <dc:creator>erichar7</dc:creator>
      <dc:date>2014-07-01T15:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying saved search permissions using the python SDK</title>
      <link>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194739#M5716</link>
      <description>&lt;P&gt;Finally, I could accomplish it in Java. Probably will help you to accomplish it in Python.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Load the savedSearch&lt;/LI&gt;
&lt;LI&gt;Get the path of the savedSearch.&lt;/LI&gt;
&lt;LI&gt;The permission of the savedSearch is called "eai:acl". So to the path of the savedSearch, append "/acl". We'll refer to it as aclPath.&lt;/LI&gt;
&lt;LI&gt;Create an Args class object.Set your arguments into the Arguments class for keys - owner, sharing, perms.read, perms.write&lt;/LI&gt;
&lt;LI&gt;Post using the class ResponseMessage ( String aclPath, Args args)&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Java Sample code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SavedSearch savedSearch = service.getSavedSearches().get("my only saved search"); 
String aclPath = savedSearch.getPath().toString().concat("/acl");
Args args = new Args();
args2.add("owner", "their_user");
args2.add("sharing","app");
args2.add("perms.read", "where_user,queue_user");
args2.add("perms.write", "who_user, which_user");
ResponseMessage rms=service.post(savedSearch.getPath()+"/acl", args2);
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Works for me !&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2014 20:53:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194739#M5716</guid>
      <dc:creator>abhijitmishra</dc:creator>
      <dc:date>2014-07-03T20:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying saved search permissions using the python SDK</title>
      <link>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194740#M5717</link>
      <description>&lt;P&gt;Have you found a way to do it in python?  I'll keep playing around with it.  Looks like I can use urllib2&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jul 2014 15:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194740#M5717</guid>
      <dc:creator>erichar7</dc:creator>
      <dc:date>2014-07-07T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying saved search permissions using the python SDK</title>
      <link>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194741#M5718</link>
      <description>&lt;P&gt;can somebody please help me here with python code,could you please help me with python code here.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 23:36:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Modifying-saved-search-permissions-using-the-python-SDK/m-p/194741#M5718</guid>
      <dc:creator>dhiren051</dc:creator>
      <dc:date>2018-04-11T23:36:27Z</dc:date>
    </item>
  </channel>
</rss>

