Question

My solution contains Site Collection scope features and has been deployed to Site Collections that the farm administrator has not been granted any explicit permissions.

If the farm administrator tries to visit the site collection in the browser he sees an Access Denied error message.

The farm admin now needs to deploy an upgrade to my Solution.

He has successfully called the powershell cmdlet Update-SPSolution

when the farm admin calls SPContentDatabase.QueryFeatures("Site",$true) it returns the feature that needs to be upgraded in the site that he has no permissions to access.

However if the farm admin calls SPFeature.Upgrade($true) then an access denied error is thrown.

How is the site collection feature upgrade supposed to work?

Should the farm admin delegate site collection feature upgrade to the site collection owner?

Should the farm admin try to impersonate the site collection administrator?

Is there some user I can elevate to that is guaranteed to be able to call Upgrade on a site collection feature?

Was it helpful?

Solution 2

We found that by using PowerShell code like this

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges( {
    $site = get-spsite "http://localhost/nonfarmadminsitecollection"
})
$elevatedSite = new-object Microsoft.SharePoint.SPSite([Guid]$site.ID,$site.SystemAccount.UserToken)

We are then able to upgrade the features in $elevatedSite.

OTHER TIPS

Farm Administrators do not by default have access to Site content.

Site collection feature upgrade and activation is normally delegated to the Site Collection Administrators (I think).

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top