Disable export for select user groups
I had a request to disable the exporting of data for select users. There currently is no built in solution for this. What I did as a work around was to create separate user groups with _noexport included in the name. I then used API to query the user groups. If the user was part of a _noexport group then it disables exporting. Unfortunately you have to include this on each widget you want to have selective export security on.
/*-------------------------------------------------------------------------------------------------*/
//CREATED BY: Ryan Wiltshire
//CREATED DT: 08/24/2015
//PURPOSE : Disable export functionality if the user is not in the appropriate group
/*-------------------------------------------------------------------------------------------------*/
function setupSecurity(){
console.log('Verifying Export Rights...');
//get all of the groups the user is part for comparison
$.getJSON("/api/users/loggedin", function(user){
//console.log('User : ' + user['_id']);
$.each(user['groups'], function(ugKey, ugValue) {
//get the group details
$.getJSON("/api/groups/"+ugValue, function(groups){
//console.log(groups['name']);
if(groups['name'].indexOf("_noExport") > -1 || groups['name'].indexOf("_noexport") > -1 || groups['name'].indexOf("_NoExport") > -1){
disableExport();
return;
}
});
});
});
}
function disableExport(){
//Show disable in the console log
console.log('Exports Disabled');
// remove export to csv in the widget editing window
widget.on('beforewidgetmenu', function(e,args){
args.items.shift();
})
// remove export to csv in the dashboard view mode
widget.on('beforewidgetindashboardmenu', function(e,args){
args.items.shift()
})
}
widget.on('ready', function(se, ev){
setupSecurity();
})
-
Hi All,
Glad to announce, we've developed a new plugin which enables one to determine which export options will be available per widget for viewer users, this can be selected/deselected from within the widget editor UI:
We have also developed a custom dashboard export plugin to provide the option to enable/disable the ability to export complete dashboards to PNG or PDF.
Contact us for a live demo!
Sisense Partner of the year 2019!
Please sign in to leave a comment.
Comments
5 comments