I have custom master page with top navigation such as Home, Admin, Finance etc. but need to hide these options according to user permission. For eg, if any user from Finance login, he should see only navigation Home, Finance (Admin should be hidden). How to achieve this? thanks in advance

  • check my updated answer Commented Oct 17, 2016 at 7:54

3 Answers 3


You can set the permission for navigation link:

  • Go to Site Settings > Navigation
  • Select Navigation Link & Click on Edit

enter image description here

  • Set Audience for the link by assigning specific groups

enter image description here


Assuming that you have custom navigation like:

  <li id='liFinance' style='display:none;'>Finance</li>
  <li id='liAdmin' style='display:none;'>Admin</li>

Now add following script to master page which will show the appropriate link as per user group:

var currentContext, currentWeb, currentUser, allGroups, arrGroups;

$(document).ready(function () {
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', setNavigationPermissions);

function setNavigationPermissions() {
    currentContext = new SP.ClientContext.get_current();
    currentWeb = currentContext.get_web();

    currentUser = currentContext.get_web().get_currentUser();

    allGroups = currentUser.get_groups();

    currentContext.executeQueryAsync(OnSuccess, OnFailure);
    function OnSuccess(sender, args) {
        var grpsEnumerator = allGroups.getEnumerator();
        while (grpsEnumerator.moveNext()) {
            var group = grpsEnumerator.get_current();
        if (arrGroups.indexOf('Admin Group') > -1) { // If User in 'Admin Group'
            document.getElementById('liAdmin').style.display = ''; // Show Admin link
        if (arrGroups.indexOf('Finance Group') > -1) { // If User in 'Finance Group'
            document.getElementById('liFinance').style.display = ''; // Show Finance link
    function OnFailure(sender, args) {
  • I am not using SharePoint default navigation but the custom navigation created by design manager Commented Oct 17, 2016 at 5:36
  • Means ? Have you hide the existing SP navigation and design your own with i.e. with <ul><li> ?? Commented Oct 17, 2016 at 6:04

If you have custom navigation, you need to handle via client side to hide/show links accordingly. For e.g.

If you have custom navigation list, it should have a column(people or group) which will hold people or group name for whicn you wanted to display particular link.

Now when the navigation is created dynamically, you have to first check current loggedin user is member of which group and its corresponding entry in navigation list.

Hope this helps!!!


It will require a lot more effort than expected. I suggest rather add a top navigation snippet on your custom Master page. Now apply similar styling as you had for your custom top navigation. For this you can take idea from this tutorial:


You might not end up with an exact match, but this will save you a lot of time. The navigation can then be easily handled as suggested by @Ronak in other answer. Hope that helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.