views:

128

answers:

0

I am trying to determine the permission level of the current user using the ECMAScript client OM. The following code always returns 0. Any thoughts?

function Initialize() {
    clientContext = new SP.ClientContext.get_current();
    web = clientContext.get_web();
    clientContext.load(web);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onSiteLoadSuccess), Function.createDelegate(this, this.onQueryFailed));
}



function isUserWebAdmin() {
        var permissionMask = null;
        permissionMask = new SP.BasePermissions();
        permissionMask.set(SP.PermissionKind.manageWeb);
        var result = new SP.BooleanResult();

        result = web.doesUserHavePermissions(permissionMask);
        alert(result.get_value())

    }

related questions