<?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: Restrict specific users to view only certain panels in Security</title>
    <link>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297733#M7976</link>
    <description>&lt;P&gt;Hi pyro_wood,&lt;BR /&gt;
you can restrict (or permit) access to a dashboard, a field or an index, you cannot restrict access to a panel.&lt;BR /&gt;
So you have two choices:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;create two dashboard, one for each role (one with all the panels and the other without the restricted panels), is more laborious to manage (you have to manage two dashboards!) but clearer for users;&lt;/LI&gt;
&lt;LI&gt;use in the restricted panel some elaboration with restrictions (e.g. fields or an eventtype), it's easier to manage (you have only one dashboard) but less beautiful to see!&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I suggest the first one!&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2017 13:24:01 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-02-14T13:24:01Z</dc:date>
    <item>
      <title>Restrict specific users to view only certain panels</title>
      <link>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297732#M7975</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'm currently trying to restrict specific users from viewing certain panels in search app. Sadly juggling around in /data/ui/views/ and metadata didn't do the trick.&lt;/P&gt;

&lt;P&gt;How can I hide certain panels like Pivot, Alerts or Reports from a user via permissions?&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2484i9721BBCE364D78D1/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
pyro_wood&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 12:47:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297732#M7975</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2017-02-14T12:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict specific users to view only certain panels</title>
      <link>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297733#M7976</link>
      <description>&lt;P&gt;Hi pyro_wood,&lt;BR /&gt;
you can restrict (or permit) access to a dashboard, a field or an index, you cannot restrict access to a panel.&lt;BR /&gt;
So you have two choices:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;create two dashboard, one for each role (one with all the panels and the other without the restricted panels), is more laborious to manage (you have to manage two dashboards!) but clearer for users;&lt;/LI&gt;
&lt;LI&gt;use in the restricted panel some elaboration with restrictions (e.g. fields or an eventtype), it's easier to manage (you have only one dashboard) but less beautiful to see!&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I suggest the first one!&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 13:24:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297733#M7976</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-02-14T13:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict specific users to view only certain panels</title>
      <link>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297734#M7977</link>
      <description>&lt;P&gt;Thank you cusello,&lt;BR /&gt;
sadly this seems to be correct!&lt;/P&gt;

&lt;P&gt;I will try the first option, thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 15:14:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297734#M7977</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2017-02-14T15:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict specific users to view only certain panels</title>
      <link>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297735#M7978</link>
      <description>&lt;P&gt;@pyro_wood, refer to one of my answers on similar lines. It restricts access to any Splunk Dashboard component by first pulling logged in user role through REST API call and then using Simple XML JS extension to restrict access via jQuery Selector.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/575377/can-i-restrict-permissions-for-the-text-box-drilld.html"&gt;https://answers.splunk.com/answers/575377/can-i-restrict-permissions-for-the-text-box-drilld.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In your case since your requirement is to hide panel and not disable, you do not require JavaScript Extension. You should be able to achieve desired results using Simple XML. Please try out the following approach and confirm:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Call REST API to get logged in User Role&lt;/STRONG&gt;. Using REST call &lt;CODE&gt;/services/authentication/current-contex&lt;/CODE&gt;, only if the logged in user has &lt;CODE&gt;admin&lt;/CODE&gt; role associated, set the &lt;CODE&gt;access&lt;/CODE&gt; token, else unset the &lt;CODE&gt;access&lt;/CODE&gt; token.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Add &lt;CODE&gt;depends&lt;/CODE&gt; attribute with token &lt;CODE&gt;access&lt;/CODE&gt; to the dashboard element/s to be hidden&lt;/STRONG&gt;. In this example &lt;CODE&gt;&amp;lt;panel depends="$access"&amp;gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;IMG src="https://wiki.splunk.com/images/7/70/Hide_Panel_for_Non_Admin.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Following is the run anywhere Simple XML code based on REST API and Splunk's _internal index:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Hide Panels based on Role&amp;lt;/label&amp;gt;
  &amp;lt;search base="baseUserRolesRESTSearch"&amp;gt;
    &amp;lt;query&amp;gt;| search NOT roles="admin"
    &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;!-- No Results Found - Hence admin role is attached with logged in user enable text box--&amp;gt;
      &amp;lt;condition match="$job.resultCount$==0"&amp;gt;
        &amp;lt;set token="access"&amp;gt;enabled&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
      &amp;lt;!-- Hence admin role is not attached with logged in user --&amp;gt;
      &amp;lt;condition&amp;gt;
        &amp;lt;unset token="access"&amp;gt;&amp;lt;/unset&amp;gt;
      &amp;lt;/condition&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input id="time1" type="time" token="tokTime" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select Time Range&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;$env:user$ Access based on role: $access$&amp;lt;/title&amp;gt;
        &amp;lt;search id="baseUserRolesRESTSearch"&amp;gt;
          &amp;lt;query&amp;gt;| rest splunk_server=local /services/authentication/current-context 
       | table roles
           &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="underLabel"&amp;gt;Logged in user ( $env:user$ ) roles&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;div&amp;gt;
          &amp;lt;p style="text-align:center;font-size:150%;color:blue;font-weight:bold"&amp;gt;Following table will be displayed only for admin and hidden for non-admin&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;      
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$access$"&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;Top 5 Splunk Components with Errors&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level!="INFO"
| stats count by component
| sort - count
| head 10
| eval access="$access$"
| fields - access&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$tokTime.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$tokTime.latest$&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Nov 2017 21:08:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Restrict-specific-users-to-view-only-certain-panels/m-p/297735#M7978</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-20T21:08:09Z</dc:date>
    </item>
  </channel>
</rss>

