3

I would like to find out whether the current user has "Manage Lists" permission in the site or not. I could not find any example to perform such a query using REST API Calls.

The endpoint based on MSDN look like this:

http:////_api/web/doesUserHavePermissions(permissionMask)

However, what should I define as "permissionMask" parameter?

Can someone give me an example?

Thanks a lot in advance.

7

I haven't been able to find a way to use doesUserHavePermissions from REST so I use effectiveBasePermissions instead:

function checkPermissions() {
    var call = jQuery.ajax({
        url: _spPageContextInfo.webAbsoluteUrl +
            "/_api/Web/effectiveBasePermissions",
        type: "GET",
        dataType: "json",
        headers: {
            Accept: "application/json;odata=verbose"
        }
    });

    call.done(function (data, textStatus, jqXHR) {
        var manageListsPerms = new SP.BasePermissions();
        manageListsPerms.initPropertiesFromJson(data.d.EffectiveBasePermissions);

        var manageLists = manageListsPerms.has(SP.PermissionKind.manageLists);

        var message = jQuery("#message");
        message.text("Manage Lists: " + manageLists);
    });
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.