Conditionally Hiding the Ribbon Based on User Permissions


So, I recently needed to hide the SharePoint 2010 ribbon. After trying several different options, I found a very simple, but solid, solution.

To start you’ll need to crack open your master page in SharePoint designer.

Next, find the <div id=”s4-ribbonrow” class=”s4-pr s4-ribbonrowhidetitle”> tag that should be just a few lines below the head tag on the standard SharePoint 2010 V4 master.

Now, you’ll want to add a SPSecurityTrimmedControl to the page like the one below.

<sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”EditListItems”></sharepoint:SPSecurityTrimmedControl>

Set the Permissions attribute to a permission that that meets your needs. If the user that is currently logged in has that permission, the elements contained within will be displayed. 

Finally, Copy & paste the <div id=”s4-ribbonrow” class=”s4-pr s4-ribbonrowhidetitle”> tag and copy & paste it and all of its contents into your SPSecurityTrimmedControl.

Now, when users visit your page, they will only see the ribbon if they have the permission you set on your SPSecurityTrimmedControl.

 

As always, if you have any way to improve this or you’ve found a mistake, let me know!

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: