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
Get Updates on the Splunk Community!

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...