I've never tried to make the User model be named anything else.  I have
users and roles many to many on both sides though.

https://github.com/justinledwards/tinyauthdb/tree/2.1/app/Model

https://github.com/justinledwards/tinyauthdb/blob/2.1/app/Model/Role.php
https://github.com/justinledwards/tinyauthdb/blob/2.1/app/Model/User.php


On Thu, May 17, 2012 at 6:50 AM, rahajiyev <rahaji...@bankofbaku.com> wrote:

> 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 <rahaji...@bankofbaku.com> 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
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to