Thursday, December 11, 2008

Show/Hide View All Site Content link in Sharepoint based on permissions

If you want to show/hide the View All Site Content link in SharePoint based on the user permissions.

connect your site to Sharepoint Designer (Daniel may be right about WSS 3.0), then navigate to _Catalogs >> masterpage >> default.master

Next find the PlaceHolderLeftNavBar content place holder and you can use the Sharepoint:SPSecurityTrimmedControl to hide a link (See example below on how to hide the "View All Site Content Link")

<asp:contentplaceholder id="PlaceHolderLeftNavBar" runat="server">
<div class="ms-quicklaunchouter">
<div class="ms-quickLaunch">
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageLists, ManageSubwebs">
<div class="ms-quicklaunchheader">
<SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" />
</div>
</SharePoint:SPSecurityTrimmedControl>
.......


You will see the PermissionString = ManageLists, ManageSubwebs which will hide this link to everyone except the Site Owner.

The PermissionsString attribute defines the permissions the user must have in order to view the content. See SPBasePermissions enumeration for a listing of possible values.


http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

No comments:

Post a Comment