Skip to content

Commit

Permalink
Updating CrudAuthorize to work like ActionsAuthorize.
Browse files Browse the repository at this point in the history
Updating tests.
Fixes #1749
  • Loading branch information
markstory committed Sep 27, 2011
1 parent 2a55423 commit a5fe702
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/Cake/Controller/Component/Auth/CrudAuthorize.php
Expand Up @@ -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']]
);
}
}
}
Expand Up @@ -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));
}

/**
Expand All @@ -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));
}


Expand Down

0 comments on commit a5fe702

Please sign in to comment.