I recently used some code I found on this site to help resolve a problem. It worked with no issues.
The one thing that is bugging me though is there is a portion of code I do not quite understand what it's doing. Still getting my head wrapped around objects at times but improving.
The original code is below. The part that I do not understand is the
manageListsPerms.initPropertiesFromJson(data.d.EffectiveBasePermissions);
Is this taking the data object returned from the REST call and changing it to "something". I think because there is no equal sign (lol) between the manageListPerms and initPropertiesFromJson is what is throwing me off. Not sure though. But, that value (manageListPerms) is being used in the next statement and that is why it is throwing me off.
Just looking for a clear understanding to help with my own knowledge.
Thanks.
Original Code:
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);
});
}
The link to the original post can be found here: How to get permission of a sharepoint list for a user using REST api