Tuesday, August 31, 2010

Hide SharePoint 2010 Ribbon Control from public users

There are some posts about how to hide SharePoint 2010 Ribbon from users with least permissions. One example is here. But it trims the ribbon from the page, which could cause some issues. Most known is a scroll bar disappearing.
BTW: there is a perfect article about SharePoint 2010 Ribbon Control from its designer.


There is the way how to real hide it depending of current user permissions (owner permission in this example). Just add this to the head section on master page.

<style type="text/css">
div#s4-ribbonrow {
display:none;
}
</style>

<Sharepoint:SPSecurityTrimmedControl runat="server"
Permissions="AddAndCustomizePages">
<style type="text/css">
div#s4-ribbonrow {
display:block;
}
</style>
</Sharepoint:SPSecurityTrimmedControl>