PROBLEM: I have a single web page in SharePoint that I want to Security trim. Since it's a one-off page, I don't want to change the master page I just want to lockdown this specific page using the Scripts web part. I've successfully been able to hide various parts of the SharePoint interface (gear wheel, ribbon tabs etc) using basic CSS. However, if I go to this page as an Administrator, I don't want anything to be hidden.
As a very basic example let's assume I just want to hide the Browse and Page tabs from the SharePoint ribbon. I can do this using the following code:
So far, so good but what if I want to prevent this modification from being applied for Administrators? To attempt this, I've modified the code as follows
As far as I understand "AddAndCustomizePages" refers to those users in the Site Members group, so the script shouldn't run for Administrators as they aren't in the Site Members group.
However, this makes absolutely no difference as Administrators still aren't able to see the Browse and Page tabs. So, either my syntax is wrong, you can't do this in the Script Editor web part or I've totally misunderstood the concept of security trimming. I'm not a developer so my understanding of the code is rudimentary. Can anyone explain in plain English why my code doesn't work and offer advice on how to achieve the result I'm looking for?
I also tried limiting the audience of the Script Editor web part to Site Members in the setting panel but this had no effect either. Stumped.