GetRolesAndPermissionsForCurrentUser - using & to check individual permissions

Jul 16, 2012 at 2:42 PM

 

var userPerm =$(xData.responseXML).find("Permissions").attr("Value");
        var hide = (16 & userPerm) != 16;
        if(userPerm==9223372036854775807){
        	hide=false;
        }

For some reason, hide evaluates to true in the first test when userPerm is = 9223372036854775807 so I had to add the extra test to set it back to false (I shouldn't have to do this though). This probably happens with other permission levels as well, not just full control. If they have the approver permission (16), then (16 & userPerm) != 16; should evaluate to false, right? Mine is evaluating to true;

Aug 6, 2012 at 12:39 PM

I am new to spservices ...Need help

hi I want to know which operation u used to get the current user's permissions

Coordinator
Aug 6, 2012 at 6:02 PM

I'd start here.

M.

Aug 7, 2012 at 7:38 AM

want to know the textual permission corresponding to a permission value

I get the permission value by calling webservice method GetRolesAndPermissionsForCurrentUser

Coordinator
Aug 7, 2012 at 11:33 AM

You'll have to "and" the permissions out of the permission mask, as shown above.

M.

Aug 9, 2012 at 7:14 PM

I've noticed that in javascript, the full permission 0x7FFFFFFFFFFFFFFF (or in decimal, 9223372036854775807) is too large to perform any bitwise operations or even simple arithmetic. It treats numbers that are too large as 9223372036854776000. Does anyone know a way around this?