Hide SharePoint Top Navigation depending on User Permissions

Based on the users SharePoint web permissions, the top navigation (global navigation element) is displayed or will be hidden.

This post addresses two issues with JavaScript:

  1. How to check a users web permissions in SharePoint
    stolen from How to check user permission for the web, list, or SharePoint Item in SharePoint JavaScript Object Model
  2. How to hide an element (in this case the DeltaTopNavigation) using JavaScript. You can modify the CSS using this approach (i.e. DISPLAY: NONE).

The Script

Here is the documentation for SP.PermissionKind Enumeration.

The Implementation

Copy the script source from above into you favourite editor and save it to e.g. the Site Assets library in SharePoint.
Add a CEWP (Content Editor Web Part) to the SharePoint page where you want to run the script and refer with a link to the text file you just created.

That’s pretty much it 🙂

661 Total Views 2 Views Today
Please follow and like:
My RSS Feed
Follow me by Email
Like it on Facebook
Share on Google+
Share on Twitter
Share on LinkedIn
Share on Xing

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)