mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
"Fixes #3851, Acl component fails to check() if a permission is denied in action (*)"
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6342 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
43eab108c7
commit
c8172ed96a
3 changed files with 37 additions and 2 deletions
|
@ -315,7 +315,7 @@ class DB_ACL extends AclBase {
|
|||
|
||||
foreach ($permKeys as $key) {
|
||||
if (!empty($perm)) {
|
||||
if ($perm[$key] === -1) {
|
||||
if ($perm[$key] == -1) {
|
||||
return false;
|
||||
} elseif ($perm[$key] == 1) {
|
||||
$inherited[$key] = 1;
|
||||
|
|
|
@ -249,6 +249,32 @@ class AclComponentTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Acl->check('Secretary','Links','delete');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links','read');
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links','create');
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links','update');
|
||||
$this->assertTrue($result);
|
||||
|
||||
$this->Acl->deny('Secretary','Links', '*');
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links','delete');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links','read');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links','create');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links','update');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $this->Acl->check('Secretary','Links');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
|
|
@ -1267,7 +1267,7 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertTrue(Validation::extension('extension.png'));
|
||||
$this->assertTrue(Validation::extension('extension.jpg'));
|
||||
$this->assertTrue(Validation::extension('extension.JPG'));
|
||||
$this->assertFalse(Validation::file('noextension'));
|
||||
$this->assertFalse(Validation::extension('noextension'));
|
||||
$this->assertTrue(Validation::extension('extension.pdf', array('PDF')));
|
||||
$this->assertFalse(Validation::extension('extension.jpg', array('GIF')));
|
||||
$this->assertTrue(Validation::extension(array('extension.JPG', 'extension.gif', 'extension.png')));
|
||||
|
@ -1282,5 +1282,14 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertFalse(Validation::extension(array('noextension', 'extension.JPG', 'extension.gif', 'extension.png')));
|
||||
$this->assertFalse(Validation::extension(array('extension.pdf', 'extension.JPG', 'extension.gif', 'extension.png')));
|
||||
}
|
||||
/*
|
||||
function TestFile() {
|
||||
$this->assertTrue(Validation::file(WWW_ROOT . 'img' . DS . 'cake.icon.gif'));
|
||||
$this->assertTrue(Validation::file(WWW_ROOT. 'favicon.ico'));
|
||||
$this->assertTrue(Validation::file(WWW_ROOT. 'index.php'));
|
||||
$this->assertTrue(Validation::file(WWW_ROOT. 'css' . DS . 'cake.generic.css'));
|
||||
$this->assertTrue(Validation::file(TEST_CAKE_CORE_INCLUDE_PATH. 'VERSION.txt'));
|
||||
}
|
||||
*/
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue