Target Users on Master Page

SPSecurityTrimmedControl will basically hide all its content from users that won’t meet a given security definition.

Unlike the previous solutions (style.display=’none’…), the content will be hidden on the server side!

Conditionally renders the contents of the control to the current user only if the current user has permissions defined in the PermissionString.

Wrap the content with a SPSecurityTrimmedControl, like this:

spsecuritytrimmedcontrol

Useful attributes of the control:

  • PermissionContext – against which user permissions will be tested

(possible values: CurrentSite, CurrentList, CurrentFolder, CurrentItem or RootSite)

  • PemissionMode – does the user have to meet all role definitions or just one of them

(possible values: All or Any)

  • PermissionsString – The PermissionsString attribute defines the permissions the user must have in order to view the content. what permissions does the user need to see the content – can enter some values separated by comma

(possible values are from the enumeration SPBasePermissions:

EmptyMask,ViewListItems,AddListItems,EditListItems,DeleteListItems,ApproveItems,OpenItems,ViewVersions,

DeleteVersions,CancelCheckout,ManagePersonalViews,ManageLists,ViewFormPages,Open,ViewPages,

AddAndCustomizePages, ApplyThemeAndBorder,ApplyStyleSheets,ViewUsageData,CreateSSCSite,

ManageSubwebs,CreateGroups, ManagePermissions,BrowseDirectories,BrowseUserInfo,AddDelPrivateWebParts,

UpdatePersonalWebParts,ManageWeb, UseClientIntegration,UseRemoteAPIs,ManageAlerts,CreateAlerts,

EditMyUserInfo,EnumeratePermissions,FullMask)

  • AuthenticationRestrictions – The AuthenticationRestrictions attribute allows output to be accessible by all, authenticated or anonymous users only. It allows to differ between authenticated and anonymous users

(possible values: AllUsers, AuthenticatedUsersOnly, AnonymousUsersOnly)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s