OK, I've worked around this deficiency by doing 2 things:
(1) added 'recursive' => 1 to AuthI
public $components = array(
'Auth' => array(
'authenticate' => array('Form' =>
array('userModel' => 'Milli', 'recursive' => 1)),
(2) writing afterFind() callback in my model:
public function afterFind(array $query) {
if (count($query) == 1) {
# single result fetched
$record = &$query[0];
if (isset($record['Role']) &&
is_array($record['Role'])) {
$roles = array();
foreach ($record['Role'] as $role)
$roles[] = $role['RolesUser']
['role_id'];
$record[$this->alias]['Role'] =
$roles;
unset($record['Role']);
}
}
return $query;
}
You bet this is ugly! But works.
There's one small problem, though. When I remove currently logged in
user's role to access a specific resource, he can still do so. Looks
like authorize() accesses Session data, and Session has active user
roles cached.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php