BUGFIX #4423: Don't allow page duplication if canCreate is false.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@85157 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-08-25 05:52:52 +00:00
parent 7eef2f4b25
commit 6a209ce8df

View File

@ -1159,7 +1159,9 @@ JS;
function duplicate() { function duplicate() {
if(($id = $this->urlParams['ID']) && is_numeric($id)) { if(($id = $this->urlParams['ID']) && is_numeric($id)) {
$page = DataObject::get_by_id("SiteTree", $id); $page = DataObject::get_by_id("SiteTree", $id);
if($page && !$page->canEdit()) return Security::permissionFailure($this); if($page && (!$page->canEdit() || !$page->canCreate())) {
return Security::permissionFailure($this);
}
$newPage = $page->duplicate(); $newPage = $page->duplicate();
@ -1178,7 +1180,9 @@ JS;
function duplicatewithchildren() { function duplicatewithchildren() {
if(($id = $this->urlParams['ID']) && is_numeric($id)) { if(($id = $this->urlParams['ID']) && is_numeric($id)) {
$page = DataObject::get_by_id("SiteTree", $id); $page = DataObject::get_by_id("SiteTree", $id);
if($page && !$page->canEdit()) return Security::permissionFailure($this); if($page && (!$page->canEdit() || !$page->canCreate())) {
return Security::permissionFailure($this);
}
$newPage = $page->duplicateWithChildren(); $newPage = $page->duplicateWithChildren();