Permalink
Browse files

Fixing issue where Aro nodes would be incorrectly formatted for use

with the AclComponent.  Fixes #1749
  • Loading branch information...
1 parent 2650bd4 commit cbc7e82bd2b8c32e7780e1bc9bd94b71bc4ef7d4 @markstory markstory committed Jun 3, 2011
@@ -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 @@
* - `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 @@
'view' => 'read',
'delete' => 'delete',
'remove' => 'delete'
- )
+ ),
+ 'userModel' => 'User'
);
/**
@@ -132,4 +134,4 @@ public function mapActions($map = array()) {
}
}
}
-}
+}
@@ -75,7 +75,7 @@ public function testAuthorizeFailure() {
->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 @@ public function testAuthorizeSuccess() {
->with($user, '/controllers/Posts/index')
->will($this->returnValue(true));
- $this->assertTrue($this->auth->authorize($user, $request));
+ $this->assertTrue($this->auth->authorize($user['User'], $request));
}
/**

0 comments on commit cbc7e82

Please sign in to comment.