Nope it doesn't work :(
authorize() in TinyAuthorize receives $user that lacks any joins to
roles table:
array(
'id' => (int) 6,
'username' => 'rihad',
'created' => '2012-05-15 16:30:10',
'modified' => '2012-05-17 16:36:24',
)
so of course it can't find $user['Role']
Here's my user class:
class Milli extends AppModel {
public $hasAndBelongsToMany = array(
'Role' => array(
'className' => 'Role',
'joinTable' =>
'roles_users',
'foreignKey' => 'user_id',
'assosciationForeignKey' => 'role_id',
'unique' =>
'keepExisting'));
}
class Role is empty.
class MilliController extends AppController
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' =>
'milli', 'action' => 'index'),
'logoutRedirect' => array('controller' =>
'milli', 'action' => 'index'),
'authenticate' => array('Form' =>
array('userModel' => 'Milli')),
'authorize' => array('Tiny' =>
array('aclModel' => 'Role')),
'loginAction' => array('controller' =>
'milli', 'action' => 'login')));
public function beforeFilter() {
$this->Auth->allow('login', 'logout');
}
Please help...
On May 17, 11:53 am, rahajiyev <[email protected]> wrote:
> OK, so I changed 'Role' to 'role' in Configure::write and it seems to
> work. I'm able to log in, and access an action that my role is
> permitted to access (as per acl.ini).
> But a strange thing happens when I attempt to access an action that
> I'm not permitted to. Instead of redirecting me to the /login page due
> to inappropriate permissions, I get silently redirected to / which I
> AM permitted to access. What's going on?
--
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