BUGFIX: Use live permissions if the stage page has been deleted. (from r91761)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96741 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-01-12 23:22:51 +00:00
parent 26244b743d
commit 0ce4714fdf

View File

@ -972,7 +972,10 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$combinedStageResult = array();
foreach(array('Stage', 'Live') as $stage) {
$result = array_fill_keys($ids, false);
// Start by filling the array with the pages that actually exist
$table = ($stage=='Stage') ? "SiteTree" : "SiteTree_$stage";
$result = DB::query("SELECT \"ID\",0 FROM \"$table\"
WHERE \"ID\" IN (".implode(", ", $ids).")")->map();
// Get the uninherited permissions
$uninheritedPermissions = Versioned::get_by_stage("SiteTree", $stage, "(\"CanEditType\" = 'LoggedInUsers' OR
@ -1013,6 +1016,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
}
$combinedStageResult = $combinedStageResult + $result;
}
}