RSS

SharePoint Data View Conditional Formatting based on user permissions (IfHasRights)

19 Oct

Below are the values for conditional formatting

example usage : <xsl:if test=”ddwrt:IfHasRights(“REPLACE THIS WITH BELOW VALUE”)”><img alt=”” border=”0″ src=”../../PublishingImages/btn_AddActionItem.jpg” width=”191″ height=”37″ /></xsl:if>

ViewListItems – 1

AddListItems – 2

EditListItems – 4

DeleteListItems – 8

ApproveItems – 16

OpenItems – 32

ViewVersions – 64

DeleteVersions – 128

CancelCheckout – 256

PersonalViews – 512

ManageLists – 2048

ViewFormPages – 4096

Open – 65536

ViewPages – 131072

AddAndCustomizePages – 262144

ApplyThemeAndBorder – 524288

ApplyStyleSheets – 1048576

ViewUsageData – 2097152

CreateSSCSite – 4194314

ManageSubwebs – 8388608

CreateGroups – 16777216

ManagePermissions – 33554432

BrowseDirectories – 67108864

BrowseUserInfo – 134217728

AddDelPrivateWebParts – 268435456

UpdatePersonalWebParts – 536870912

ManageWeb – 1073741824

UseRemoteAPIs – 137438953472

ManageAlerts – 274877906944

CreateAlerts – 549755813888

EditMyUserInfo – 1099511627776

EnumeratePermissions – 4611686018427387904

FullMask – 9223372036854775807

To ensure that users only see the edit button if they are the author of the posting, or a site owner we added the following conditional formatting:

test=”ddwrt:IfHasRights(2048) or contains(@Author,$Userid)”

About these ads
 
3 Comments

Posted by on October 19, 2009 in Code Snippets, Sharepoint Designer

 

Tags:

3 responses to “SharePoint Data View Conditional Formatting based on user permissions (IfHasRights)

  1. Spiral

    June 29, 2010 at 5:56 PM

    Hi Jim,

    Thank you for the info – it was really helpful!

    I have one question though; I am building conditional formattings for list items and for that reason i have created a custom permission level within my subsite. I have named it “Editors” and i have assigned only view and edit rights to this role.

    Now, when i want to show my content to specific groups, i have to apply conditional formatting, where i use the “IfHasRights” expression. And i want to include in this expression the Permission Mask of my custom permission level (Editors).

    Is there any way to include this in the XPath Expression (can i find this Mask anywhere), or should i use a combination of Expressions, i.e. ddwrt:IfHasRights(1) and ddwrt:IfHasRights(4) – for viewing AND editing rights?

    Many thanks in advance.

     
  2. bassamdarras

    March 14, 2011 at 8:35 PM

    great blog thanks

     
  3. Joe

    April 27, 2011 at 12:44 AM

    Extremely helpful – thanks!

     

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

 
Follow

Get every new post delivered to your Inbox.

Join 81 other followers

%d bloggers like this: