How to hiding or showing ribbon control (with navigation breadcrumb) for anonymous or read access users like visitor or limited access users in sharepoint 2010 ( SP 2010 ) dynamically based on user's access:
SharePoint 2010
introduced new feature called “ Ribbon “ and it provides great user experience for users with
elevated privileges, like contributors and site owners. However, Its not
suggested for users with lease privilege, such as visitors and anonymous users
since most of features are applicable for them.
SPSecurityTrimmedControl
which is used to show / hide the ribbon
control.
Steps:
1)
Open your SharePoint master page to edit it.
2)
Find the following line wth the highlighted text in your master page.
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
Note: This div only contains the
whole part of out of box sharepoint ribbon control.
3) To hide the above div element, Find the
following line in your master page.
<div id="s4-workspace"
4) Now add the following code in your master page
just above the “s4-workspace” div element.
<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server"
PermissionsString="ManagePermission">
<script type="text/javascript">
document.getElementById("s4-ribbonrow").style.display = "none";
</script>
</Sharepoint:SPSecurityTrimmedControl>
<script type="text/javascript">
document.getElementById("s4-ribbonrow").style.display = "none";
</script>
</Sharepoint:SPSecurityTrimmedControl>
5)
To apply changes, Save the master page and
publish it.
No comments:
Post a Comment