Updating CrudAuthorize to work like ActionsAuthorize.

Updating tests.
Fixes #1749
This commit is contained in:
mark_story 2011-09-26 20:38:23 -04:00
parent 2a554237f4
commit a5fe702624
2 changed files with 4 additions and 3 deletions

View file

@ -90,6 +90,7 @@ class CrudAuthorize extends BaseAuthorize {
);
return false;
}
$user = array($this->settings['userModel'] => $user);
$Acl = $this->_Collection->load('Acl');
return $Acl->check(
$user,
@ -97,4 +98,4 @@ class CrudAuthorize extends BaseAuthorize {
$this->settings['actionMap'][$request->params['action']]
);
}
}
}

View file

@ -86,7 +86,7 @@ class CrudAuthorizeTest extends CakeTestCase {
->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 @@ class CrudAuthorizeTest extends CakeTestCase {
->with($user, 'Posts', 'read')
->will($this->returnValue(false));
$this->assertFalse($this->auth->authorize($user, $request));
$this->assertFalse($this->auth->authorize($user['User'], $request));
}