none
How to get the current user permission level on a list item with ecmascript RRS feed

  • Question

  • I want to locate the role the current user has on a specific list item then get the permission level (role definition. Binding) name.  For example. User1 has a read or contribute. Permission. Level on the current list item.

    All this must be done with javascript.  I am able to get up to listitem.get_roleassignments().getByPrincipal(user)  but I don't know where to go from there.

    Sunday, May 27, 2012 5:20 PM

Answers

  • Hi Alrick,

    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
    }
    }}


    Basweshver Jewale

    Monday, May 28, 2012 4:05 AM

All replies

  • Hi Alrick,

    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
    }
    }}


    Basweshver Jewale

    Monday, May 28, 2012 4:05 AM
  • Hi Alrick,

    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 } }}

    How may i know excatly current item rights for current user

    Monday, June 22, 2015 5:23 PM