mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing issue where Aro nodes would be incorrectly formatted for use
with the AclComponent. Fixes #1749
This commit is contained in:
parent
2650bd4639
commit
cbc7e82bd2
3 changed files with 8 additions and 5 deletions
|
@ -35,6 +35,7 @@ class ActionsAuthorize extends BaseAuthorize {
|
|||
*/
|
||||
public function authorize($user, CakeRequest $request) {
|
||||
$Acl = $this->_Collection->load('Acl');
|
||||
$user = array($this->settings['userModel'] => $user);
|
||||
return $Acl->check($user, $this->action($request));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ abstract class BaseAuthorize {
|
|||
* - `actionPath` - The path to ACO nodes that contains the nodes for controllers. Used as a prefix
|
||||
* when calling $this->action();
|
||||
* - `actionMap` - Action -> crud mappings. Used by authorization objects that want to map actions to CRUD roles.
|
||||
* - `userModel` - Model name that ARO records can be found under. Defaults to 'User'.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -53,7 +54,8 @@ abstract class BaseAuthorize {
|
|||
'view' => 'read',
|
||||
'delete' => 'delete',
|
||||
'remove' => 'delete'
|
||||
)
|
||||
),
|
||||
'userModel' => 'User'
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -132,4 +134,4 @@ abstract class BaseAuthorize {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class ActionsAuthorizeTest extends CakeTestCase {
|
|||
->with($user, '/controllers/Posts/index')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$this->assertFalse($this->auth->authorize($user, $request));
|
||||
$this->assertFalse($this->auth->authorize($user['User'], $request));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ class ActionsAuthorizeTest extends CakeTestCase {
|
|||
->with($user, '/controllers/Posts/index')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$this->assertTrue($this->auth->authorize($user, $request));
|
||||
$this->assertTrue($this->auth->authorize($user['User'], $request));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue