SPBasePermissions Demystified


Read It

SharePoint Foundation has defined built-in permissions Represented by class RoleDefinitions in Object model. In addition to the built-in permissions you have an option of creating a new Permission Level (RoleDefinition) also as per your needs.

Everything you access in SharePoint revolves around the permissions defined within the site. To view the level of permissions that your site has use http://YourSite/_layouts/role.aspx.

How Its Done

It is important to note that permission defined in SharePoint represents a single binary digit. When you want to assign multiple permission to a single role you will need to use bitwise operator OR for it.

For instance, users with ViewListItems, EditListItems, AddListItmes and DeleteListItems permissions will have decimal 15 or hex 0xF as their permissions mask.

0001 (0x1, 1) ViewListItems

0010 (0x2, 2) EditListItems

0100 (0x3, 4) AddListItmes

OR 1000 (0x4, 8 ) DeleteListItems

= 1111 (0xF, 15)

As you can see SPBasePermissions enum is representing in hex and stored as unsigned long.

For more information on SPBasePermissions Enumeration refer: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

Finally

Here is the complete table of permissions with their hex and decimal values:

Permission Name Hex (base 16)   Decimal
EmptyMask 0x0000000000000000   0
List and Document permission      
ViewListItems 0x0000000000000001   1
AddListItems 0x0000000000000002   2
EditListItems 0x0000000000000004   4
DeleteListItems 0x0000000000000008   8
ApproveItems 0x0000000000000010   16
OpenItems 0x0000000000000020   32
ViewVersions 0x0000000000000040   64
DeleteVersions 0x0000000000000080   128
CancelCheckout 0x0000000000000100   256
ManagePersonalViews 0x0000000000000200   512
ManageLists 0x0000000000000800   2048
ViewFormPages 0x0000000000001000   4096
Web level permission      
Open 0x0000000000010000   65536
ViewPages 0x0000000000020000   131072
AddAndCustomizePages 0x0000000000040000   262144
ApplyThemeAndBorder 0x0000000000080000   524288
ApplyStyleSheets 0x0000000000100000   1048576
ViewUsageData 0x0000000000200000   2097152
CreateSSCSite 0x0000000000400000   4194314
ManageSubwebs 0x0000000000800000   8388608
CreateGroups 0x0000000001000000   16777216
ManagePermissions 0x0000000002000000   33554432
BrowseDirectories 0x0000000004000000   67108864
BrowseUserInfo 0x0000000008000000   134217728
AddDelPrivateWebParts 0x0000000010000000   268435456
UpdatePersonalWebParts 0x0000000020000000   536870912
ManageWeb 0x0000000040000000   1073741824
UseRemoteAPIs 0x0000002000000000   137438953472
ManageAlerts 0x0000004000000000   274877906944
CreateAlerts 0x0000008000000000   549755813888
EditMyUserInfo 0x0000010000000000   1099511627776
Special Permissions      
EnumeratePermissions 0x4000000000000000   4611686018427387904
FullMask 0x7FFFFFFFFFFFFFFF   9223372036854775807
UseClientIntegration 0x1000000000   68719476736

 

I found an interesting post on SharePoint Permission Dependency Chart here: http://skurocks.wordpress.com/2008/09/20/sharepoint-permission-dependency-chart/

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.