mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1687 from kinglozzer/1685-cancreate-top-level
FIX: content authors unable to duplicate top-level pages (fixes #1685)
This commit is contained in:
commit
73b854ca72
@ -1049,7 +1049,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fall over to inherited permissions
|
// Fall over to inherited permissions
|
||||||
if($parent) {
|
if($parent && $parent->exists()) {
|
||||||
return $parent->canAddChildren($member);
|
return $parent->canAddChildren($member);
|
||||||
} else {
|
} else {
|
||||||
// This doesn't necessarily mean we are creating a root page, but that
|
// This doesn't necessarily mean we are creating a root page, but that
|
||||||
|
@ -512,6 +512,10 @@ class SiteTreeTest extends SapphireTest {
|
|||||||
$this->assertTrue(singleton('SiteTreeTest_ClassA')->canCreate(null));
|
$this->assertTrue(singleton('SiteTreeTest_ClassA')->canCreate(null));
|
||||||
$this->assertFalse(singleton('SiteTreeTest_ClassA')->canCreate(null, array('Parent' => $parentB)));
|
$this->assertFalse(singleton('SiteTreeTest_ClassA')->canCreate(null, array('Parent' => $parentB)));
|
||||||
$this->assertTrue(singleton('SiteTreeTest_ClassC')->canCreate(null, array('Parent' => $parentB)));
|
$this->assertTrue(singleton('SiteTreeTest_ClassC')->canCreate(null, array('Parent' => $parentB)));
|
||||||
|
|
||||||
|
// Test creation underneath a parent which doesn't exist in the database. This should
|
||||||
|
// fall back to checking whether the user can create pages at the root of the site
|
||||||
|
$this->assertTrue(singleton('SiteTree')->canCreate(null, array('Parent' => singleton('SiteTree'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEditPermissionsOnDraftVsLive() {
|
public function testEditPermissionsOnDraftVsLive() {
|
||||||
|
Loading…
Reference in New Issue
Block a user