mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Updating CrudAuthorize to work like ActionsAuthorize.
Updating tests. Fixes #1749
This commit is contained in:
parent
2a554237f4
commit
a5fe702624
2 changed files with 4 additions and 3 deletions
|
@ -90,6 +90,7 @@ class CrudAuthorize extends BaseAuthorize {
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$user = array($this->settings['userModel'] => $user);
|
||||||
$Acl = $this->_Collection->load('Acl');
|
$Acl = $this->_Collection->load('Acl');
|
||||||
return $Acl->check(
|
return $Acl->check(
|
||||||
$user,
|
$user,
|
||||||
|
|
|
@ -86,7 +86,7 @@ class CrudAuthorizeTest extends CakeTestCase {
|
||||||
->with($user, 'Posts', 'read')
|
->with($user, 'Posts', 'read')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
$this->assertTrue($this->auth->authorize($user, $request));
|
$this->assertTrue($this->auth->authorize($user['User'], $request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ class CrudAuthorizeTest extends CakeTestCase {
|
||||||
->with($user, 'Posts', 'read')
|
->with($user, 'Posts', 'read')
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
|
|
||||||
$this->assertFalse($this->auth->authorize($user, $request));
|
$this->assertFalse($this->auth->authorize($user['User'], $request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue