Boyan's Blog

Snippets of code and fun.

Hiding the ribbon in SharePoint 2010 based on permissions

Rate This
  • Comments 1

Have you ever noticed how in SharePoint 2010 Owners see the ribbon and can click Site Actions, and Readers see the ribbon too but there is no Site Actions to click. In some cases there is nothing else going on up there for Readers. It is wasted real estate!

Owner:

 

Reader:

 

The Reader can use all the extra space for some website goodness!

This is easy to solve.

- Open the master page, find the div tag: <div id="s4-ribbonrow"
- Put the following around it:
<Sharepoint:SPSecurityTrimmedControl runat="server" Permissions="ManageWeb">
<div id="s4-ribbonrow"</div>
</SharePoint:SPSecurityTrimmedControl>

Et voila!

 

More info here:

- http://social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/9e52de43-7941-4e61-976b-d6bf2f8d926c
- http://fusionovation.com/blogs/mbell/archive/2008/09/18/security-trimmed-controls-in-sharepoint.aspx
- http://sharepoint.smayes.com/2011/02/hiding-the-sharepoint-2010-ribbon-for-readers-a-proof-of-concept/

 

 

Leave a Comment
  • There is also a javascript that works too:

    <script type="text/javascript">

       var ribbonRow = document.getElementById("s4-ribbonrow");

       if(ribbonRow.innerHTML.indexOf("Browse") == -1)

       {

           ribbonRow.style.display = "none";

       }

    </script>