in

Melyssa’s Blog

Security Trimmed Controls in SharePoint

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.
Published Sep 18 2008, 05:52 PM by mbell
Filed under:

Comments

 

Hide Ribbon and Site Actions In SharePoint 2010 « Hoang Nhut Nguyen said:

Pingback from  Hide Ribbon and Site Actions In SharePoint 2010 &laquo; Hoang Nhut Nguyen

December 28, 2010 8:44 PM
 

Boyan's blog said:

Have you ever noticed how in SharePoint 2010 Owners see the ribbon and can click Site Actions, and Readers

May 19, 2011 1:05 PM
Powered by Community Server (Commercial Edition), by Telligent Systems