Security

Can we hide splunk bar base on role or user?

Raymond2T
Path Finder

Hello,

Whenever a user logins to Splunk with some role, I want to hide the Splunk App bar from that specific user/role.

Without using hidesplunkbar=true

How can I achieve it? 

Thanks a lot. 

Labels (1)
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@Raymond2T - You should be able to achieve it with Javascript.

 

Use the rest-endpoint to get the user role in JS. (run a search query) . And then with JS hide/show Splunk App bar based on user role.

 

require(['jquery', 'splunkjs/mvc/simplexml/ready!'], function ($) {
    $(document).ready(function () {
        var SearchManager = require('splunkjs/mvc/searchmanager');

        var searchString = '| rest /services/authentication/current-context splunk_server=local | table title roles';

        var mySearchManager = new SearchManager({
                id : "cacheSearch",
                earliest_time : "-24h",
                latest_time : "now",
                autostart : true,
                search : searchString,
                preview : true,
                cache : false
            });

        var myResults = mySearchManager.data("results"); // get the data from that search
        myResults.on("data", function () {
            resultArray = myResults.data().rows;
            $.each(resultArray, function (index, value) {
                // Check for the user role here
                // And hide/show Splunk App panel by modifying CSS property "display" for that HTML component
            });
        });
    });
});

 

 

I hope this helps!!!

Raymond2T
Path Finder

Thank you so much for your reply. let me try it. 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...