mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Clean up CMSMain::CanOrganiseSitetree
This commit is contained in:
parent
75f41b56d5
commit
3a1329f61b
@ -756,7 +756,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
if (!SecurityToken::inst()->checkRequest($request)) {
|
||||
return $this->httpError(400);
|
||||
}
|
||||
if (!Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN')) {
|
||||
if (!$this->CanOrganiseSitetree()) {
|
||||
return $this->httpError(
|
||||
403,
|
||||
_t(
|
||||
@ -862,11 +862,16 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
->setBody(json_encode($statusUpdates));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whatever the current member has the permission to reorganise SiteTree objects.
|
||||
* @return bool
|
||||
*/
|
||||
public function CanOrganiseSitetree()
|
||||
{
|
||||
return !Permission::check('SITETREE_REORGANISE') && !Permission::check('ADMIN') ? false : true;
|
||||
return Permission::check('SITETREE_REORGANISE');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
|
@ -660,4 +660,24 @@ class CMSMainTest extends FunctionalTest
|
||||
$searchSchema
|
||||
);
|
||||
}
|
||||
|
||||
public function testCanOrganiseSitetree()
|
||||
{
|
||||
$cms = CMSMain::create();
|
||||
|
||||
$this->assertFalse($cms->CanOrganiseSitetree());
|
||||
|
||||
$this->logInWithPermission('CMS_ACCESS_CMSMain');
|
||||
$this->assertFalse($cms->CanOrganiseSitetree());
|
||||
|
||||
$this->logOut();
|
||||
$this->logInWithPermission('SITETREE_REORGANISE');
|
||||
$this->assertTrue($cms->CanOrganiseSitetree());
|
||||
|
||||
$this->logOut();
|
||||
$this->logInWithPermission('ADMIN');
|
||||
$this->assertTrue($cms->CanOrganiseSitetree());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user