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.
@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!!!
Thank you so much for your reply. let me try it.