Get the current user permission level on a list item with ecmascript 分类: Sharepoint 2015-07-14 14:13 7人阅读 评论(0) 收藏

时间:2023-03-09 02:49:39
Get the current user permission level on a list item with ecmascript                                                    分类:            Sharepoint             2015-07-14 14:13    7人阅读    评论(0)    收藏

To Check current users permissions using Ecmascript\Javascript client object model SharePoint 2010.

function checkifUserHasEditPermissions()
{
context = new SP.ClientContext.get_current();
web = context.get_web();
this._currentUser = web.get_currentUser();
context.load(this._currentUser);
context.load(web,'EffectiveBasePermissions');
context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
}
function onSuccessMethod(sender, args)
{
if (web.get_effectiveBasePermissions().has(SP.PermissionKind.editListItems))
{
//User Has Edit Permissions
}
}}