mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG fix CMS_ACCESS permission being ignored if in incorrect order in array
This commit is contained in:
parent
7a462cecef
commit
f1a0aef0d7
@ -185,10 +185,9 @@ class Permission extends DataObject implements TemplateGlobalProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (substr($permCode, 0, 11) === 'CMS_ACCESS_') {
|
elseif (substr($permCode, 0, 11) === 'CMS_ACCESS_' && !in_array('CMS_ACCESS_LeftAndMain', $code)) {
|
||||||
//cms_access_leftandmain means access to all CMS areas
|
//cms_access_leftandmain means access to all CMS areas
|
||||||
$code[] = 'CMS_ACCESS_LeftAndMain';
|
$code[] = 'CMS_ACCESS_LeftAndMain';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ class PermissionTest extends SapphireTest {
|
|||||||
$members = Member::get()->byIDs($this->allFixtureIDs('Member'));
|
$members = Member::get()->byIDs($this->allFixtureIDs('Member'));
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
$this->assertTrue(Permission::checkMember($member, 'CMS_ACCESS'));
|
$this->assertTrue(Permission::checkMember($member, 'CMS_ACCESS'));
|
||||||
|
$this->assertTrue(Permission::checkMember($member, array('CMS_ACCESS', 'CMS_ACCESS_Security')));
|
||||||
|
$this->assertTrue(Permission::checkMember($member, array('CMS_ACCESS_Security', 'CMS_ACCESS')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$member = new Member();
|
$member = new Member();
|
||||||
@ -37,6 +39,8 @@ class PermissionTest extends SapphireTest {
|
|||||||
));
|
));
|
||||||
$member->write();
|
$member->write();
|
||||||
$this->assertFalse(Permission::checkMember($member, 'CMS_ACCESS'));
|
$this->assertFalse(Permission::checkMember($member, 'CMS_ACCESS'));
|
||||||
|
$this->assertFalse(Permission::checkMember($member, array('CMS_ACCESS', 'CMS_ACCESS_Security')));
|
||||||
|
$this->assertFalse(Permission::checkMember($member, array('CMS_ACCESS_Security', 'CMS_ACCESS')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLeftAndMainAccessAll() {
|
public function testLeftAndMainAccessAll() {
|
||||||
|
Loading…
Reference in New Issue
Block a user