Permissions/Need elevation?

Aug 27, 2010 at 2:05 PM

Love the library and have already found a lot of uses for it.  One use was to put a link on our Sites so end users could see who 'owned' the site (has full control).  Built the following function called correctly from the link for everyone.  Problem is if not Site Collection Administrator, nothing appears to come back.  I have confirmed that the groups themselves are set so "everyone" can see membership.  Does this need to be elevated somehow?  If so, how?

	function findOwners() {
		//Find all groups with Full Control
		$().SPServices({
			operation:"GetGroupCollectionFromRole",
			roleName:"Full Control",
			async:false,
			completefunc:function(xData, Status) {
				$allFC=xData.responseXML.xml;
			}
		});
		
		//Find all users with Full Control
		$().SPServices({
			operation:"GetUserCollectionFromRole",
			roleName:"Full Control",
			async:false,
			completefunc:function(xData, Status) {
				$allUsersFC=xData.responseXML.xml;
			}
		});
	
		//Explode group to find individuals in group
		$expandGroup = "";
		$($allFC).find("Group").each(
			function() {
				$eg = $().SPServices({
					operation:"GetUserCollectionFromGroup",
					groupName:$(this).attr("Name"),
					async:false,
					completefunc:function(xData, Status) {
						$expandGroup=$expandGroup + xData.responseXML.xml;
					}
				});
			}
		);
		
		//Combine the two XML results into one object
		$xml = $expandGroup + $allUsersFC;
	
		$userArray = $($xml).find("User").toArray();
		$ua = new Array(0);
		$($userArray).each(
			function() {
				$ua[$ua.length] = $(this).attr("Name");
			}
		);
		$userArray = getUniqueNames($ua);
		
		$thisSiteOwnersAre = "The following users are listed as Owners of this site:\n" + $userArray;
		alert($thisSiteOwnersAre);
	}

Coordinator
Aug 27, 2010 at 2:33 PM

jaeemare:

There's no way to "elevate" permissions with the Web Services; they always run with the current user's credentials. If people other than Site Collection Administrators aren't seeing the results, I'd look at the messages coming back from the Web Services for clues as to the issue. It may be that this approach just won't work. With custom code on the server side, you can do the elevation, of course.

M.

Aug 27, 2010 at 6:33 PM

{sniffle} Oh well.  That was going to provide some much needed functionality here in the easiest way; I just *loved* the end result.