in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

echef

From the cluttered (and clustered) brain of Josef Nielsen... A great place for Food, Friends, and... uh... SharePoint of course!

Security Trimming WebControls and ASP Objects

I hadn't used this yet, and had cause to this week.  It works slick, and is pretty configurable... I used it to hide the SiteActions button on list pages for members, but not admins, as well as admin web parts embedded in a page.  It works with Web Parts, Web Controls, and other ASP.Net objects (ie. SharePoint:*, etc.).  Wrap the content you want trimmed in the following code (using SPD):

<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="BrowseDirectories">
[Content to Trim]
</Sharepoint:SPSecurityTrimmedControl>

You can then swap out the "BrowseDirectories" with whatever you need for the trimming.  Here are the one's I've found handy so far:

  • BrowseDirectories = Anyone but Limited Read (Anonymous is Limited Read)
  • ManageWeb = Site Collection Admins
  • ManageSubwebs = Site Owners
  • AddListItems = Site Members and specified list contributors

Here's a link to all the defined values in the SPBasePermissions Enum.

Published Jan 22 2008, 01:18 PM by josef.nielsen
Filed under: ,

Comments

 

Links (1/24/2008) « Steve Pietrek’s SharePoint Stuff said:

Pingback from  Links (1/24/2008) &laquo; Steve Pietrek&#8217;s SharePoint Stuff

January 24, 2008 8:18 PM
 

Hexanes! » Security Trimming WebControls and ASP Objects said:

Pingback from  Hexanes! &raquo; Security Trimming WebControls and ASP Objects

February 29, 2008 8:02 AM

About josef.nielsen

I'm a long time computer nerd, living and loving technology wherever I can find it. I've recently shifted from a focus in MS SQL server, MSCS Clustering, and High Availability Engineering to focus on collaboration technologies, including SharePoint 2007. I recently moved from my long-time home in Seattle Washington to Salt Lake City.

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts