This project has moved and is read-only. For the latest updates, please go here.

How to get permissons for curren user for List with unique permissons

Feb 4, 2010 at 3:18 PM


I’ve looked for a solution to check currentUser permission for a sharepoint list which does not inherit a site permissions.
I did not get such permisions with GetRolesAndPermissionsForCurrentUser because it returns just a site permissions, no a list permissions.
May be is there any way around?

Here in my function, just from example

var xd='';
function isHasRights(){    
    var r = false;
            operation: "GetRolesAndPermissionsForCurrentUser",
            async: false,
            completefunc: function(xData, Status) {
                var userPerm = $(xData.responseXML).find("[nodeName=Permissions]").attr("Value");            
                alert("userPerm = " + userPerm);
                var nonAdminP = (33554432 & userPerm) == 33554432;
                alert("nonAdminP == 33554432: " + nonAdminP);
                var adminP = userPerm == 9223372036854775807;
                r = (nonAdminP | adminP) ? true : false; 
    return r;

I run this in Google Chrome, then I check xd variable in console.

Here is what I get


<soap:envelope xmlns:soap=​"http:​/​/​​soap/​envelope/​" xmlns:xsi=​"http:​/​/​​2001/​XMLSchema-instance" xmlns:xsd=​"http:​/​/​​2001/​XMLSchema">​
      <getrolesandpermissionsforcurrentuserresponse xmlns=​"http:​/​/​​sharepoint/​soap/​directory/​">​
         <getrolesandpermissionsforcurrentuserresult>            <rolesandpermissions>​
               <permissions Value=​"206292717568">​
                  <role ID=​"1073741825" Name=​"Ограниченный доступ" Description=​"Возможность просмотра списков, библиотек документов, списков элементов, папок и документов при наличии разрешений." Hidden=​"True" Type=​"Guest" BasePermissions=​"206292717568">​




Feb 4, 2010 at 4:54 PM


Yes, if you look at the SDK, the GetRolesAndPermissionsForCurrentUser method returns roles and permissions at the site level.  There are other Web Services available what may be more usful for what you are trying to do.  Take a look at the Permissions.GetPermissionCollection Method.