In some cases you could get this kind of hexadecimal numbers from Sharepoint for the PermMask: 0xb008431061
, or 0x1b03c4313ff
, and so on.
To verify the PermMask against the different level of permissions you can proceed with the below method (using functions from core.js
):
var permMask = '0x1b03c4313ff'; var permissions = new SP.BasePermissions(); permissions.initPropertiesFromJson({High:GetPermMaskH(permMask), Low:GetPermMaskL(permMask)}); // we can now check permissions using SP.BasePermissions.has() // and we can compare with SP.PermissionKind — see https://msdn.microsoft.com/en-us/library/office/ee556747(v=office.14).aspx var canEdit = permissions.has(SP.PermissionKind.editListItems);
On Sharepoint 2010 GetPermMaskH
and GetPermMaskL
are not defined, so here is their code:
function GetPermMaskH(b) { var a = b.length; return a <= 10 ? 0 : parseInt(b.substring(2, a - 8), 16) } function GetPermMaskL(b) { var a = b.length; return a <= 10 ? parseInt(b) : parseInt(b.substring(a - 8, a), 16) }
It took me many hours to find how to proceed, so I hope it will help some others.
Thank you! This is exactly what I was looking for