Hide Ribbon from Users with Read Permissions

Hiding the ribbon depending on users permissions.

Read access will hide the ribbon so it will behave like an anonymous user navigating to the site.

Open up your custom master Page in SP Designer 2010.

1. Add a display:none style to the s4-ribbonrow element so it looks like the below code

<div id=”s4-ribbonrow” class=”s4-pr s4-ribbonrowhidetitle” style=”display:none”>

2. add the below snippet inbetween the s4-ribboncont and the s4-ribbonrow Div

<Sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”ManageLists”>
<script type=”text/javascript”> document.getElementById(“s4-ribbonrow”).style.display = “block”;</script>

3. Close the control by adding the below snippet just above the the s4-ribboncont and the s4-ribbonrow Div

</Sharepoint:SPSecurityTrimmedControl>

Your code should look like this:


<div id="s4-ribbonrow" style="display: none">

<Sharepoint:SPSecurityTrimmedControl runat="server" Permissions="ManageLists">

<script type="text/javascript"> document.getElementById("s4-ribbonrow").style.display = "block";</script>

</Sharepoint:SPSecurityTrimmedControl>

Notes:

I have only tested this in SharePoint 2010 as I do not use SharePoint 2013.

I copied this from s SharePoint Design course I participated in with www.synergyonline.com

For other useful tips, check out their Blog Posts: http://www.synergyonline.com/blog

Advertisements