Wednesday, February 16, 2011

Hide "View All Site Content" Link for non-admin users

This may be a topic that some of you would ask, why now? Well, I have been tasked with hiding the infamous "View All Site Content" (VASC) link on a SharePoint 2007 site. Now I knew about the custom solution that one can download the codeplex solution that will add a custom action to allow you to do just this. However, in order to get this to work, one has to install the wsp and activate the feature. In my case, the client did not want any installation done of custom solutions. So I had to find an alternative. I knew SharePoint designer (SPD) was going to have to come into play here.

Well, I hopped onto google and yay, I found what I was looking for. Jason Colon wrote an article on e-how that explains how to hide the link by setting the Visible property of the SPSecurityTrimmedControl to False. But this hides the link for all users...


But being me and knowing that business users are quite troublesome at time, forever changing their minds about certain rules etc, I wanted a solution that allows admin users to be able to use the VASC in order to speed up their tasks. That's when I came across a gem on the net :) 


Clayton James gives a good example of how to use the SPSecurityTrimmed control to achieve this. Boy, was I glad for this info!


I then proceeded to test my new-found knowledge...

On the masterpage,  I basically changed the PermissionsString parameter of the Sharepoint:SPSecurityTrimmedControl that encapsulates the VASC link:

<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageWeb">
                <div class="ms-quicklaunchheader"><SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
                </SharePoint:SPSecurityTrimmedControl>
 

By changing the default value of "ViewFormPages" to "ManageWeb", I now had control over who can see the VASC link!  Here is a list of values you can use.


Turns out that Admin users now can see the VASC link, while users with lesser privileges (such as contribute or read) are unable to see the link. Exactly what I wanted!

See... No VASC

Only thing that the solution does not cater for is the event where the user types in the actual URL to view all content (_layouts/viewlsts.aspx). Let's hope your normal users never finds out about this URL o_O. 
I would be glad to hear if anyone found a solution to that problem.


Go ahead... try it and let me know what you think.


Happy growing .: