Showing posts with label Ribbon in SharePoint 2013. Show all posts
Showing posts with label Ribbon in SharePoint 2013. Show all posts

Monday, November 4, 2013

Hide Ribbon from Anonymous users in SharePoint 2013

In my current project, I had a requirement to hide the ribbon from anonymous users dude to security reasons. In SharePoint 2010 we can do that by modifying the master page. But in 2013, we can’t modify the master page directly. We need to modify the .html file associated with the master page.

We have .html file for every master page with same name, for Seattle.master we have seattle.html and oslo.master we have oslo.html pages which specify the controls and tags of the master page.

We can see the tags in HTML pages start with <!--MS:--> and <!--ME:--> that shows the markup inside of the tags for the corresponding masterpage. We need to do changes in the html page to hide the ribbon from anonymous users.

Open html page in SharePoint designer 2013, (Master Pages-> Select appropriate html file, Edit the file)



Search for “<div class =”ms-belltown-anonshow”>” tag and add following code on the top of the div,
<!—MS:<SharePoint:SpSecurityTrimmedControl runat=”server” permission=”AddandCustomizepages”>—>

Add following code after closing div tag.
<!—MS:</SharePoint:SpSecurityTrimmedControl>—>



Save HTML file. After adding these tags, design manager will update the respective masterpage for hiding the ribbon from Anonymous users. Instead of “AddandCustomizepages” permissions, we can give list of enumeration permissions referred in the link