1

I am trying to hide SharePoint ribbon in master page based on permissions. I am using Seattle master page.

After going through many blogs, I tried as below Wrap ms-designer-ribbon div tag between SharePoint:SPSecurityTrimmedControl tag. Just like shown in https://spgeeks.devoworx.com/hide-ribbon-sharepoint-2013-using-css/

But when I add between SPSecurityTrimmedControl tag, the ribbon is completely hidden to everyone. Its not getting hidden based on permissions. I have not even added CSS style as display:none.

Not sure where I am going wrong.

 <!--MS:<SharePoint:SPSecurityTrimmedControl runat="server" AuthenticationRestrictions="AnonymousUsersOnly">--> <!--SPM:<wssucw:Welcome runat="server" EnableViewState="false" />--> <div id="ms-designer-ribbon"> <!--SID:02 {Ribbon}--> <!--PS: Start of READ-ONLY PREVIEW (do not modify) --><div class="DefaultContentBlock" style="background:rgb(0, 114, 198); color:white; width:100%; padding:8px; height:64px; overflow:hidden;">In true previews of your site, the SharePoint ribbon will be here.</div><!--PE: End of READ-ONLY PREVIEW --> </div> <!--ME:</SharePoint:SPSecurityTrimmedControl>--> 

Thanks in advance.

1 Answer 1

1

You are missing PermissionsString in your code.

As per the reference you provided, you can add any permission type from the below list based on your requirement:

  • FullMask

  • EmptyMask

  • ManagePermissions

  • ManageSubwebs

  • ManageWeb

  • AddAndCustomizePages

  • BrowseDirectories

  • ViewPages

  • ManageAlerts

Read more about SharePoint Base Permissions at SPBasePermissions Enum

4
  • Hello Ganesh, even after adding permissionstring - FullMask the ribbon is not being displayed. Ribbon is getting hidden all time. Commented Nov 19, 2020 at 10:50
  • Hi Usha, does this issue resolved? Have you followed the exact same steps given in article? Commented Nov 24, 2020 at 15:22
  • Hello Ganesh, Thank you for followup and sorry that i couldnt update back. yes the issue has been resolved by adding a separate SPSecurityTrimmedControl . Means now i have the original TrimmedControl as is and wrapped ms-designer-ribbon in another SPSecurityTrimmedControl with ManageWeb PermissionsString. else it wasnt working. Commented Nov 25, 2020 at 16:13
  • Great, glad it worked out for you. Please Upvote(^) and accept as an Answer as it will help others with same issue to find the correct answer easily in future . Commented Nov 25, 2020 at 16:40

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.