You shall sooner or later face a situation that you need to create a control under specific (custom) permission levels. SPSecurityTrimmedControl is one control that can give you such features.
A simple SPSecurityTrimmedControl can be added to you page as shown below:
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="XYZ">
</Sharepoint:SPSecurityTrimmedControl>
Now, the XYZ can be any of the following as mentioned below.
Scenario: If I need to give specific users permissions to Edit the page; I use below lines of code...
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="AddAndCustomizePages">
<div>
<a href="javascript:MSOLayout_ToggleLayoutMode();">Edit Page</a>
</div>
</Sharepoint:SPSecurityTrimmedControl>
Which means any user who belongs to a group with permissions for 'Adding and Customozing the Pages' can see the hyperlink Edit Page.
_____________________________________________________________________
List Permissions
ManageLists
CancelCheckout
AddListItems
EditListItems
DeleteListItems
ViewListItems
ApproveItems
OpenItems
ViewVersions
DeleteVersions
CreateAlerts
ViewFormPages
Site Permissions
ManagePermissions
ViewUsageData
ManageSubwebs
ManageWeb
AddAndCustomizePages
ApplyThemeAndBorder
ApplyStyleSheets
CreateGroups
BrowseDirectories
CreateSSCSite
ViewPages
EnumeratePermissions
BrowseUserInfo
ManageAlerts
UseRemoteAPIs
UseClientIntegration
Open
EditMyUserInfo
Personal Permissions
ManagePersonalViews
AddDelPrivateWebParts
UpdatePersonalWebParts
A simple SPSecurityTrimmedControl can be added to you page as shown below:
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="XYZ">
</Sharepoint:SPSecurityTrimmedControl>
Now, the XYZ can be any of the following as mentioned below.
Scenario: If I need to give specific users permissions to Edit the page; I use below lines of code...
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="AddAndCustomizePages">
<div>
<a href="javascript:MSOLayout_ToggleLayoutMode();">Edit Page</a>
</div>
</Sharepoint:SPSecurityTrimmedControl>
Which means any user who belongs to a group with permissions for 'Adding and Customozing the Pages' can see the hyperlink Edit Page.
_____________________________________________________________________
List Permissions
ManageLists
CancelCheckout
AddListItems
EditListItems
DeleteListItems
ViewListItems
ApproveItems
OpenItems
ViewVersions
DeleteVersions
CreateAlerts
ViewFormPages
Site Permissions
ManagePermissions
ViewUsageData
ManageSubwebs
ManageWeb
AddAndCustomizePages
ApplyThemeAndBorder
ApplyStyleSheets
CreateGroups
BrowseDirectories
CreateSSCSite
ViewPages
EnumeratePermissions
BrowseUserInfo
ManageAlerts
UseRemoteAPIs
UseClientIntegration
Open
EditMyUserInfo
Personal Permissions
ManagePersonalViews
AddDelPrivateWebParts
UpdatePersonalWebParts
Comments