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

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. – Usha Ramani Nov 19 '20 at 10:50
  • Hi Usha, does this issue resolved? Have you followed the exact same steps given in article? – Ganesh Sanap Nov 24 '20 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. – Usha Ramani Nov 25 '20 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 . – Ganesh Sanap Nov 25 '20 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.