Merge branch '3.4' into 3.5

This commit is contained in:
Daniel Hensby 2016-12-07 13:43:34 +00:00
commit e90715d6c6
No known key found for this signature in database
GPG Key ID: 229831A941962E26
3 changed files with 6 additions and 2 deletions

View File

@ -1019,7 +1019,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
}
// Fall over to inherited permissions
if($parent) {
if($parent && $parent->exists()) {
return $parent->canAddChildren($member);
} else {
// This doesn't necessarily mean we are creating a root page, but that

View File

@ -52,7 +52,7 @@
? (parentTree.getValue() || this.getParentID())
: null,
newClassName = metadata ? metadata.ClassName : null,
hintKey = (newClassName && parentMode === 'child')
hintKey = (newClassName && parentMode === 'child' && id)
? newClassName
: 'Root',
hint = (typeof hints[hintKey] !== 'undefined') ? hints[hintKey] : null,

View File

@ -545,6 +545,10 @@ class SiteTreeTest extends SapphireTest {
$this->assertTrue(singleton('SiteTreeTest_ClassA')->canCreate(null));
$this->assertFalse(singleton('SiteTreeTest_ClassA')->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() {