<?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 Variables/constants for roles in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Variables-constants-for-roles/m-p/138600#M8367</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Is there any way to assign a 'variable' to a role?&lt;/P&gt;

&lt;P&gt;We're creating a dashboard for many sites (15+) which will show their local information.&lt;/P&gt;

&lt;P&gt;The idea is that they would log in and get their local dashboard based on role.&lt;/P&gt;

&lt;P&gt;Notes:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;The dashboard is written in Advanced XML with macros to centralise the queries.&lt;/LI&gt;
&lt;LI&gt;We're avoiding using variables in the URL to avoid the site looking up other sites' details.&lt;/LI&gt;
&lt;LI&gt;We'd like to package it up as an app to allow for change control, deployment, etc (we can decentralise the queries quite easily)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Nov 2013 12:48:50 GMT</pubDate>
    <dc:creator>splunked38</dc:creator>
    <dc:date>2013-11-12T12:48:50Z</dc:date>
    <item>
      <title>Variables/constants for roles</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Variables-constants-for-roles/m-p/138600#M8367</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Is there any way to assign a 'variable' to a role?&lt;/P&gt;

&lt;P&gt;We're creating a dashboard for many sites (15+) which will show their local information.&lt;/P&gt;

&lt;P&gt;The idea is that they would log in and get their local dashboard based on role.&lt;/P&gt;

&lt;P&gt;Notes:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;The dashboard is written in Advanced XML with macros to centralise the queries.&lt;/LI&gt;
&lt;LI&gt;We're avoiding using variables in the URL to avoid the site looking up other sites' details.&lt;/LI&gt;
&lt;LI&gt;We'd like to package it up as an app to allow for change control, deployment, etc (we can decentralise the queries quite easily)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2013 12:48:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Variables-constants-for-roles/m-p/138600#M8367</guid>
      <dc:creator>splunked38</dc:creator>
      <dc:date>2013-11-12T12:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variables/constants for roles</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Variables-constants-for-roles/m-p/138601#M8368</link>
      <description>&lt;P&gt;If you're looking for getting current logged in user's role and having that in a variable inside the dashboard, you can use following query (works for user role as well) to get the same and can use ResultValueSetter module to have that stored into a variable in dashboard.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/authentication/users splunk_server=local | search [| rest /services/authentication/current-context | rename username as title | fields title] | table title, roles
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And this can be used in dashboard like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;module name="Search"&amp;gt;
            &amp;lt;param name="search"&amp;gt;
                &amp;lt;![CDATA[
    | rest /services/authentication/users splunk_server=local 
    | search [| rest /services/authentication/current-context 
    | rename username as title | fields title] | table title, roles
                    ]]&amp;gt;

            &amp;lt;/param&amp;gt;
            &amp;lt;module name="ResultsValueSetter"&amp;gt;
                &amp;lt;param name="fields"&amp;gt;title, roles&amp;lt;/param&amp;gt;
                ....
                ....
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Nov 2013 14:46:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Variables-constants-for-roles/m-p/138601#M8368</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-12T14:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Variables/constants for roles</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Variables-constants-for-roles/m-p/138602#M8369</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;

&lt;P&gt;I just thought about this again and have a few caveats which I'll probably post as separate questions.&lt;/P&gt;

&lt;P&gt;Ideally, we're trying to avoid using Sideview utils for the time being (I suspect this cannot be avoided, don't have anything against Sideview utils, just wondering if it's possible).&lt;/P&gt;

&lt;P&gt;Your search solution works fine but the role needs to be set as a $variable$ which I can then use:&lt;BR /&gt;
*as output eg: &lt;DESCRIPTION&gt;Dashboard 1 ($variable$)&lt;/DESCRIPTION&gt;&lt;BR /&gt;
*as part of another search/macro eg: macro(site=$variable$)&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2013 15:14:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Variables-constants-for-roles/m-p/138602#M8369</guid>
      <dc:creator>splunked38</dc:creator>
      <dc:date>2013-11-12T15:14:53Z</dc:date>
    </item>
  </channel>
</rss>

