BUGFIX Using SiteTree->getSiteConfig() instead of SiteConfig::current_site_config() in SiteTree::batch_permission_check() to avoid cases where multiple variances of SiteConfig need to be considered (e.g. when using the subsites module) (AIR-59)

This commit is contained in:
Ingo Schommer 2011-09-09 17:36:34 +02:00
parent 1fcc987b78
commit 6ab1340680

View File

@ -1123,14 +1123,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if($potentiallyInherited) {
// Group $potentiallyInherited by ParentID; we'll look at the permission of all those
// parents and then see which ones the user has permission on
$siteConfigPermission = SiteConfig::current_site_config()->{$siteConfigMethod}($memberID);
$groupedByParent = array();
foreach($potentiallyInherited as $item) {
if($item->ParentID) {
if(!isset($groupedByParent[$item->ParentID])) $groupedByParent[$item->ParentID] = array();
$groupedByParent[$item->ParentID][] = $item->ID;
} else {
$result[$item->ID] = $siteConfigPermission;
// Might return different site config based on record context, e.g. when subsites module is used
$siteConfig = $item->getSiteConfig();
$result[$item->ID] = $siteConfig->{$siteConfigMethod}($memberID);
}
}