Permalink
Browse files

Updating CrudAuthorize to work like ActionsAuthorize.

Updating tests.
Fixes #1749
  • Loading branch information...
1 parent 2a55423 commit a5fe702624819b08248df3407cce65d526e00eeb @markstory markstory committed Sep 27, 2011
@@ -90,11 +90,12 @@ public function authorize($user, CakeRequest $request) {
);
return false;
}
+ $user = array($this->settings['userModel'] => $user);
$Acl = $this->_Collection->load('Acl');
return $Acl->check(
$user,
$this->action($request, ':controller'),
$this->settings['actionMap'][$request->params['action']]
);
}
-}
+}
@@ -86,7 +86,7 @@ public function testAuthorizeCheckSuccess() {
->with($user, 'Posts', 'read')
->will($this->returnValue(true));
- $this->assertTrue($this->auth->authorize($user, $request));
+ $this->assertTrue($this->auth->authorize($user['User'], $request));
}
/**
@@ -108,7 +108,7 @@ public function testAuthorizeCheckFailure() {
->with($user, 'Posts', 'read')
->will($this->returnValue(false));
- $this->assertFalse($this->auth->authorize($user, $request));
+ $this->assertFalse($this->auth->authorize($user['User'], $request));
}

0 comments on commit a5fe702

Please sign in to comment.