This SharePoint 2013 tutorial explains, SPSecurityTrimmedControl in SharePoint 2013/2010.
This is a very beautiful thing that SharePoint 2010 provides, probably it was there in MOSS 2007 also known as spsecuritytrimmedcontrol. SPSecurityTrimmedControl in SharePoint is used to conditionally renders the contents of the control to the current user only if the current user has permissions defined in the PermissionString. The same way also spsecuritytrimmedcontrol SharePoint 2013 works.
SPSecurityTrimmedControl in SharePoint 2013/2010
SPSecurityTrimmedControl helps to do security trimming of the child controls inside it. You just need to put the controls inside SPSecurityTrimmedControl and then it will display or hide the controls based on the permission specified in SharePoint 2010/2013.
By using SPSecurityTrimmedControl you can also hide the Site Actions menu, View All Site Content menu from Anonymous Users.
Here you need to put your control inside the tag like
<Sharepoint:SPSecurityTrimmedControl runat=”server” PermissionsString=”ManageLists”> <PublishingSiteAction:SiteActionMenu runat=”server” /> </SharePoint:SPSecurityTrimmedControl>
Here the SiteActionMenu will appear to those users who belongs to ManageLists permissions.
The permissionsString attribute defines the permissions the user must have in order to view the content. So PermissionsString is very much important here. There are lots of permission available like below, and also you can check in this msdn url.
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
If you want to give multiple permissions to the PermissionString then you can give a comma separated like below:
<SharePoint:SPSecurityTrimmedControl PermissionsString=”AddAndCustomizePages, ManageLists” runat=”server”> <PublishingSiteAction:SiteActionMenu runat=”server” /> </SharePoint:SPSecurityTrimmedControl>
You may like following SharePoint tutorials:
- How to display or show breadcrumbs in SharePoint 2010?
- How to use Language Integrated Query LINQ in SharePoint 2013 or SharePoint 2010?
- Add a custom web part to the page layout in SharePoint 2013 or SharePoint 2010
- Sandboxed solutions in SharePoint 2010
- How to create a flyout menu in sharepoint 2010
- How to use WebProvisioned event in SharePoint 2010?
- SharePoint Development Best Practices [Custom Development using Visual Studio]
- Create Visual Web Part using Visual Studio 2010 in SharePoint 2010
Hope this article will be helpful to know about spsecuritytrimmedcontrol in SharePoint 2013/2010.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.