At my starting page i displayed documents and an upload link to upload a document. If a user has read access, he also see the upload link. But i would like to have it like the “add new item” link below the normal list views – only the user with the right access permission can add new items. So what can be done? Using javascript? I asked google and google gave me the hint to look into this post from Scott Hatcher, in which he wrote about Conditionally Format XSLT Based on User Permissions. I tried and it works like charm for me.
Just insert a snippet of code around your upload link which look like this:
[sourcecode language=”csharp”]
[/sourcecode]
If you want to use other permissions like delete or anything, you just have to change the number at IfHasRights(XX). See the following table.
| Permission | Code |
| 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 |
..:: I LIKE SHAREPOINT ::..