GetPermissionCollection for subsite w/ inheritance broken

Jun 4, 2010 at 6:03 PM

Mark,

I am trying to use the GetPermissionCollection operation to return, for a given subsite, the permissions associated with it.
  $().SPServices({
     operation: "GetPermissionCollection",
     objectName: "/PN64370",
     objectType: "Web",
     async: false,
     completefunc: function(xData, Status) {
    
     var out = $().SPServices.SPDebugXMLHttpResult({
   node: xData.responseXML
  });
  $("#WSOutput").html("").append("<b>This is the raw output from the debugged GetPermissionCollection operation:</b>" + out);
     }
   }); /* close GetPermissionCollection */

It returns permission groups as expected [so I am not missing any brackets or colons] but when the subsite as a broken inheritance and I removed or added one or multiple groups,
the output remain the same [list of permission of the parent site].

Any clues?
Greg

PS: I am still using 1.4.2 on that one

Coordinator
Jun 4, 2010 at 8:11 PM

I'm not really sure. (I can't claim the oddities in what the Web Services return, just the oddities I've created to access them.)

So what you're saying is that if the permissions inheritance has been broken for a site, you're getting the permissions back for the parent site?

M.

Jun 4, 2010 at 8:59 PM

That's what it seems. In my example, /PN64370.aspx is the relative URL of the subsite.
I tried both cases [with permissions inherited / broken] and both return the same thing (the inherited list of permissions).
G.

Coordinator
Jun 4, 2010 at 9:06 PM
Edited Jun 5, 2010 at 4:52 AM

Do you have a different environment you can try it in just in case?  And I assume you aren't passing the .aspx part?

M.

Jun 4, 2010 at 9:22 PM

I was thinking of trying it out this week end.
Just passing the:
operation: "GetPermissionCollection",
     objectName: "/PN64370",
     objectType: "Web",
Could it be some delay with the server or something like the changes in permissions are not 'instantenous'?

Coordinator
Jun 5, 2010 at 4:53 AM

The permissions should be applied immediately, so I don't think that's it.

Let me know if you see the same thing in a different environment.  If you do, I'll try to test it on my end.

M.

Jun 11, 2011 at 11:56 PM

Pretty late response though...

Same thing happening on my end - the GetPermissionCollection returns the current site's permission if the targeted sub-site breaks inheritance. The call to the ws only works properly if made from within the sub-site.

No solution for me either.

May 4, 2013 at 10:27 PM
Marc,

I had downloaded the code from your blog post that showed how to manipulate SharePoint Groups. Basically it just worked:-) This was a while back. Today, I decided tyo read through it line-by line and I noticed the following code, which is also shown above:

$().SPServices({
 operation: "GetPermissionCollection",
 objectName: "/PN64370",
 objectType: "Web",
 async: false,
 completefunc: function(xData, Status) 
What struck me is the ObjectName. Is this a special Object Name that every SharePoint installation has? It seemed to work in my environment? Is there a site by that name? I tried to google it, but I didn't find anything except for this codeplex posting.
  • Marcel
Coordinator
May 5, 2013 at 5:36 AM
Marcel:

Which post are you referring to? I can't find one with the GetPermissionCollection call.

M.
May 6, 2013 at 1:56 PM
Marc,

Hmmm....

You are correct. I think a while ago I added the code in the sample above and ghot it to run in my environment. I am just getting around to dissecting the code and I turned on the output and noticed it was working.

This leads me to believe that either:
  1. The operation "GetPermissionCollection", doesn't care what you put in the objectName parameter.
OR
  1. objectName: "/PN64370" exists on my installation? Which would probably imply that it exists on all implementations.
Any thoughts?
Feb 21, 2014 at 5:46 PM
Edited Feb 21, 2014 at 5:48 PM
I know this is an old post, but I needed to do this exact thing myself. I read this article and many others and came up with the same results ... I kept getting the same results for subsites as for the parent. I had just about given up on it after two days of frustration. I ended the day with the thought that I would sleep on it and attack it the next day. Well, while laying in the bed something came to me (I often get many of my solutions right before sleeping on it) ... the syntax seemed different than other SPServices syntax. So the next morning I tried this:
  function getSitePermissions(siteURL){
      $().SPServices({
         webURL: siteURL, // this was the key I think
         operation: "GetPermissionCollection",
         objectName: siteURL,
         objectType: "Web",
         completefunc: function (xData, Status) {
           .
           .
           .
         }
     });
  }
That did it for me! Just thought I would post just in case someone else was attempting to use this. I would also like to say thanks again Marc ... SPServices is a lifesaver for me!