user1697272 February 2016

Hiding some Sharepoint elements from ribbon only for Read Only (non admins) with custom css

I am trying to make some page corrections only for some groups of site ins Sharepoint. I can check admin user in master page with SPSecurityTrimmedControl, but how can I insert custom css into master page only for let's say Read Only users? If I am trying like this:

<SharePoint:SPSecurityTrimmedControl PermissionsString="ViewPages" runat="server"> 

Css adds up not only for Read Only users but for Admin user as well. Is there any chances to split .css by groups? Thank you

Answers


Thriggle March 2016

This requirement might best be handled using audience targeting.

You can put the CSS into a Script Editor (or even an old Content Editor) web part and add it to the page. Then click the "Edit Web Part" option in the corner of the web part to make the web part properties panel appear. At the bottom of that panel, in the "Advanced" section, there's a field where you can enter "Target Audiences."

In the Target Audiences field, enter the names of any groups for whom you want the CSS to appear.

That web part will only be visible to members of the specified groups, regardless of their permissions on the site.

Note: The only real downside to this approach is that it only applies to specific pages where you add the web part and apply the audience targeting; it won't apply to all pages as if added to the masterpage of the site.

Post Status

Asked in February 2016
Viewed 3,729 times
Voted 10
Answered 1 times

Search




Leave an answer