0

I have removed ribbonrow for nonadmin users using the following Code:

Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ManageWeb">
 <script type="text/javascript">
    document.getElementById("s4-ribbonrow").style.display = "block";
 </script>
</Sharepoint:SPSecurityTrimmedControl>  

and this:

<div id=”s4-ribbonrow” class=”s4-pr s4-ribbonrowhidetitle” style=”display:none”>

It is working fine, with no ManageWeb permission i cannot see the ribbon, but i I owe this permission i.e Administrator I can the the ribbonrow only in homepage if I go to another subsite I cannot see the ribbonrow. How to fix this up?

  • possibly the permissions are being checked for the web where the master page is hosted, as opposed to the "current" web – Tiago Duarte Apr 18 '16 at 14:17
  • @TiagoDuarte I apologize for my poor knowledge of SharePoint could you be more specific please? – Nderon Hyseni Apr 18 '16 at 14:19
  • are you admin on the subsite? – Tiago Duarte Apr 18 '16 at 14:30
  • yes I am fully admin in all sharepoint – Nderon Hyseni Apr 18 '16 at 14:31
  • @TiagoDuarte thanks mate for your help. I have reset masterpage inherits for all subsites and now it is working Thank you so much – Nderon Hyseni Apr 18 '16 at 15:08
2

One of the properties of SPSecurityTrimmedControl is PermissionContext.

Not sure what the default is, but you may try and set it to "RootSite" or "CurrentSite" according to where you want the permissions to look when opening a site.

Possible values are:

PermissionContext.CurrentFolder

PermissionContext.CurrentItem

PermissionContext.CurrentList

PermissionContext.CurrentSite

PermissionContext.RootSite

enter image description here

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.