Security Trimmed Controls in SharePoint

by Melyssa Bell September 18, 2008
Let’s say you have a control on your page that you want only a certain group of users to see. Fortunately, SharePoint has a built-in control that lets you hide controls to which users do not have the necessary permissions.  This control is the SPSecurityTrimmedControl.
<Sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”ManageLists”>
Place your control(s) here
</SharePoint:SPSecurityTrimmedControl>
All you have to do is wrap your control with this security control and set the correct permissions in the Permissions attribute. The Permissions attribute, when used in Visual Studio or Designer, will have intellisense and will be filled with the following properties obtained from http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx.  Whatever permissions you specify will be required by the user in order to view the control(s) inside of the SPSecurityTrimmedControl:

AddAndCustomizePages
AddDelPrivateWebParts
AddListItems
ApplyStyleSheets
ApplyThemeAndBorder
ApproveItems
BrowseDirectories
BrowseUserInfo
CancelCheckout
CreateAlerts
CreateGroups
CreateSSCSite
DeleteListItems
DeleteVersions
EditListItems
EditMyUserInfo
EmptyMask
EnumeratePermissions
FullMask
ManageAlerts
ManageLists
ManagePermissions
ManagePersonalViews
ManageSubwebs
ManageWeb
Open
OpenItems
UpdatePersonalWebParts
UseClientIntegration
UseRemoteAPIs
ViewFormPages
ViewListItems
ViewPages
ViewUsageData
ViewVersions

** You can also use the PermissionsString property to use a comma seperated list.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Search Blog

WELCOME TO OUR BLOG

Fusionovation is an industry blog written by Smooth Fusion team members that serves to inform marketers of cutting-edge digital topics and trends.

Smooth Fusion specializes in helping marketers with the planning and implementation of digital campaigns and ongoing programs. We are a trusted partner to marketing agencies and corporate marketers worldwide, delivering our unique blend (or fusion) of technical expertise and understanding of the needs of marketers.

Our team is made up of consultants, project managers, software engineers, developers, designers, and quality assurance specialists. And what we all have in common is experience using technology to empower marketers. Learn more about Smooth Fusion.