Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Ok, here is the scenario. I have a parent site with 3 sub-sites. When I am logged in as myself, "site owner; site collection admin" I can view the results of this query. When i log in as a different user who is just a "member" of this site, the query doesn't return anything. I can't even get it to alert the xData.responseText, any ideas on where my permissions are messed up?

Here is the code:

        //get sub-Sites and put into an array
        var subSite = new Array();
        $().SPServices({
        operation: "GetAllSubWebCollection",
        async:false,
        completefunc: function(xData, Status) {
            $(xData.responseXML).find("Webs > Web").each(function() {
                //alert(xData.responseText);
                var $node = $(this);
                var siteTitle = $node.attr("Title").replace(/\s/g, "");
                subSite.push( siteTitle );
                //alert(siteTitle);
            });
            }
        }); 
share|improve this question

3 Answers 3

You see everything because you have the highest privledges available to you as being a site collection admin. You will see everything regardless if you do not have permissions because web serivces execute under the permissions of the current user. Regular users do not have that luxury.

I gave another user account full control permissions o my site and that code doesn't alert to it either. It must be something native to the site collection admin privledge set as once I added that user, the alert displayed.

share|improve this answer
    
Interesting. let me know if you have any luck with it. Any ideas as to how to get around that? –  Brenton Pierce Jun 6 '12 at 18:44
    
You have to be able to iterate the subwebs to see the results. The average user can't. There's not way to "get around it" other than changing the user's permissions. –  Marc D Anderson Jun 6 '12 at 19:29
    
What permissions would I set up across each site? Here is the intended scenario The users who are able to see the parent site can see all sub sites, but the members of sub-sites can't see the parent sites or sibling sites. –  Brenton Pierce Jun 6 '12 at 20:48

Have you tried moving the alert outside the .find.each?

    //get sub-Sites and put into an array 
    var subSite = new Array(); 
    $().SPServices({ 
    operation: "GetAllSubWebCollection", 
    async:false, 
    completefunc: function(xData, Status) { 
        alert(xData.responseText); // <- Like here
        $(xData.responseXML).find("Webs > Web").each(function() { 
            var $node = $(this); 
            var siteTitle = $node.attr("Title").replace(/\s/g, ""); 
            subSite.push( siteTitle ); 
            //alert(siteTitle); 
        }); 
        } 
    }); 
share|improve this answer
    
I have, and it just says Access Is Denied as the reason. I tried adding the user to all sub-sites as well, and that didn't seem to do anything either. Is there like a superusers group that is above full control or anything like that in SP? –  Brenton Pierce Jun 6 '12 at 19:26
    
site collection administrators are above full control –  PirateEric Jun 6 '12 at 19:27
    
Does the users have access to ALL sites in the site collection? GetAllSubWebCollection returns all sites where GetWebCollection only returns sub sites. –  Per Jakobsen Jun 6 '12 at 19:33
    
The users who are able to see the parent site can see all sub sites, but the members of sub-sites can't see the parent sites or sibling sites. –  Brenton Pierce Jun 6 '12 at 20:47

Ok, here is what I ended up doing, I erased the roll your own version and just went with a customized CrossList DVWP. I modified the XSL and now I can see all sub sites regardless of user and permissions. Solved!!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.