How to hide "Settings" gear icon for non-admin users ?

by SidS » Tue Feb 07, 2017 3:29 pm

I like what I saw so far and thinking to propose my company to purchase this Org Chart for Office 365.
We want to put this app on Home page and want to make sure that everyone can use the features e.g. filter by name, expand/collapse levels.

However, we don't want non-admin users to modify its settings like color/theme, number of levels to display etc...

Is there a way to achieve this requirement ?
User avatar
SidS
 
Posts: 2
Joined: Tue Feb 07, 2017 3:26 pm

by Anton Khritonenkov » Tue Feb 07, 2017 3:31 pm

Hi,

Thank you for your question.

It is hidden from non-admin users by default. It is only visible to users with Full Control (Manage web) permissions.
User avatar
Anton Khritonenkov
 
Posts: 219
Joined: Wed Nov 12, 2014 1:33 pm

by SidS » Tue Feb 07, 2017 3:35 pm

Hi,

Is there a way to hide it for "Manage Web" permissions holders and only enable or make it visible for Site Collection Admins ?

Thank you,
Sraddhan
User avatar
SidS
 
Posts: 2
Joined: Tue Feb 07, 2017 3:26 pm

by Anton Khritonenkov » Tue Feb 07, 2017 3:56 pm

You can do it using JavaScript. Just paste this code into Custom JavaScript editor in the configuration wizard of the web part:

Code: Select all
var $settingsMenuItem = renderer.querySelector(".poch-wizard-link");

//Query informatio about current user
var context = SP.ClientContext.get_current();
var web = context.get_web();
var currentUser = web.get_currentUser()
context.load(web, "CurrentUser");
context.executeQueryAsync(function(){
 
  //hide menu item if non site collection admin
  if(!currentUser.get_isSiteAdmin()){
    $settingsMenuItem.hide();
  }

})
User avatar
Anton Khritonenkov
 
Posts: 219
Joined: Wed Nov 12, 2014 1:33 pm


Return to Org Chart for Office 365