0

I'm currently building a master page for a SharePoint 2010 site using Designer 2010. The look and feel has been largely completed, however I'd like to hide a component from everybody except the admins of the site.

My SPSecurityTrimmedControl currently looks like this:

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl" runat="server" AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="FullMask" PermissionContext="RootSite">
    // ... HTML elements to be hidden
</SharePoint:SPSecurityTrimmedControl>

However, as it stands now, it only shows the control for everybody except admins, which is not what I want. Does anybody know what the proper permissions are for this control to be hidden from users that are not admins?

Thanks.

EDIT Updated the question to clarify what I am hiding. It will hide HTML elements/JavaScript, as opposed to code (such as C#).

1
  • Good day, I try to change my html for master page to hide s4-ribbonrow from readers. I wrote ``` <div id="ms-designer-ribbon"> <!--MS:<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl" runat="server" Permissions="ViewPages">--> <style type="text/css"> #s4-ribbonrow{display:none;} </style> <!--ME:</SharePoint:SPSecurityTrimmedControl>--> <!--SID:02 {Ribbon}--> </div> ``` But it didn't work. The reader can view s4-ribbonrow. Maybe I do something wrong? Would be grateful for any help.
    – Anonymous
    Commented May 21, 2020 at 17:05

1 Answer 1

2

FullMask is correct, however I think you are approaching it wrong.

You would want the the SPSecurityTrimmedControl to either include the desired html block so it is only visible to them or the html block would be hidden by default with your CSS and your SPSecurityTrimmedControl would include a CSS override to show the content.

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl" runat="server" Permissions="FullMask">
    <a href="#">Something top secret</a>
</SharePoint:SPSecurityTrimmedControl>

or something like

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl" runat="server" Permissions="FullMask">
    <style type="text/css">
      #someID {visibility: visible;}
    </style>
</SharePoint:SPSecurityTrimmedControl>
2
  • Sorry, I should clarify that the html elements (rather than code) is what's contained in the block. I'll update the question. Commented Jan 17, 2017 at 20:36
  • I was able to get it working as intended thanks to your help. +1 Commented Jan 20, 2017 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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