Hide the price, prepress, properties, etc buttons in the admin site - xmpie-users/uStore-js GitHub Wiki

Background

The usergroup permissions of uStore allow administrators to control who can access the admin application and what sections of the admin site the users in the group can see and use. This is great, but for many customers it does not provide enough granularity. For example if the store administrator wants to create a user group with permissions for users to add or edit products in the storefront, it means that the user can control pricing and other product properties that are visible in the product setup, and that the admin might prefer to manage himself/herself.

Solution

Add the following JavaScript code to the admin master page. The master page can be found at: installDrive:\XMPie\uStore\App\AdminApp\PageLayout\Admin.Master

<script type="text/javascript">
function addCSSRule(sheet, selector, rules, index) {
  if(sheet.insertRule) {
    sheet.insertRule(selector + "{" + rules + "}", index);
  } else {
    sheet.insertRule(selector, rules, index);
  }
}

var LoginName = document.getElementById('ctl00_cphHeader_ctl00_ActiveUserLabel');
var userNameToLock = '[email protected]'; //set this to be the username you want to prevent access for
if(LoginName.innerHTML == userNameToLock) {									
  addCSSRule(document.styleSheets[0], ".HeaderCell.Orders", "display:none"); //this hides the orders tab button
  addCSSRule(document.styleSheets[0], ".HeaderCell.Users", "display:none"); //this hides the users tab button
  addCSSRule(document.styleSheets[0], ".HeaderCell.Reports", "display:none"); //this hides the reports tab button
  addCSSRule(document.styleSheets[0], ".productSetupOptionTile", "display:none !important"); //this hides all the 
     //setup tiles (pricing, properties, customization, inventory, recipeint list,  prepress, etc. 
     //Alternatively you can hide individual tiles by using the relevant id rather than the class.
}
</script>

Note / warning

Changes to the master pages will be overwritten if you repair or update the uStore software. So, take note of your changes and keep a backup file so you can edit the changes again after running the uStore installer.

⚠️ **GitHub.com Fallback** ⚠️