Check current login user permission using JSOM in SharePoint 2013/2016

Hi All,


One of the easiest way to check the current logged in user privilege in JSOM


if (SP.PageContextInfo.get_webPermMasks().has([26])) {  
   //your code goes here... 
}


Below are the list of permission types and it's index. 


Permission Type
Index
emptyMask
0
viewListItems
1
addListItems
2
editListItems
3
deleteListItems
4
approveItems
5
openItems
6
viewVersions
7
deleteVersions
8
cancelCheckout
9
managePersonalViews
10
manageLists
12
viewFormPages
13
anonymousSearchAccessList
14
open
17
viewPages
18
addAndCustomizePages
19
applyThemeAndBorder
20
applyStyleSheets
21
viewUsageData
22
createSSCSite
23
manageSubwebs
24
createGroups
25
managePermissions
26
browseDirectories
27
browseUserInfo
28
addDelPrivateWebParts
29
updatePersonalWebParts
30
manageWeb
31
anonymousSearchAccessWebLists
32
useClientIntegration
37
useRemoteAPIs
38
manageAlerts
39
createAlerts
40
editMyUserInfo
41
enumeratePermissions
63
fullMask
65


:) coding

Regards
Ratsub

Comments