RSS
 

Leave a Reply

Tip:
If you need to post a piece of code use {code type=php}...{/code}.
Allowed types are "php", "mysql", "html", "js", "css".

Please do not escape your post (leave all ", <, > and & as they are!). If you have encoded characters and need to reverse ("decode") it, you can do that here!
 

 
  1. Mark

    February 24, 2014 at 20:02

    Hi there,

    I have been trying to get this going for a few hours now. I wonder if I am missing something obvious.

    Authentication is working fine without your plugin (with no roles). I am using a role model with containable. My array looks like this:

    [code type=php}
    array(
    'User' =&gt; array(
    'id' =&gt; '1',
    'username' =&gt; 'mark',
    'Role' =&gt; array(
    (int) 0 =&gt; array(
    'id' =&gt; '1',
    'alias' =&gt; 'Superadmin',
    'RolesUser' =&gt; array(
    'id' =&gt; '1',
    'role_id' =&gt; '1',
    'user_id' =&gt; '1'
    )
    ),
    (int) 1 =&gt; array(
    'id' =&gt; '2',
    'alias' =&gt; 'Owner',
    'RolesUser' =&gt; array(
    'id' =&gt; '2',
    'role_id' =&gt; '2',
    'user_id' =&gt; '1'
    )
    )
    )
    )
    )
    {/code}

    I've done a bit of debugging here and there and can confirm the values are being loaded from the acl.ini file. But as soon as I enable the plugin using

    ($this->Auth->authorize = array('Tools.Tiny');

    I get stuck in a redirect loop.

    My component array looks like this:

    'Auth' => array(
    	    'loginRedirect' => array(
                    'controller' => 'dashboard',
                    'action' => 'index'
                ),
                'logoutRedirect' => array(
                    'controller' => 'users',
                    'action' => 'login'
                ),	    
    	    'authenticate' => array(
    		'Form' => array(
    		    'contain' => array('Role')
    		)
    	    )
    	)

    Any tips?

    Many thanks in advance, Mark

     
  2. Mark

    February 24, 2014 at 20:02

    Here is that array again with proper formatting:

    array(
    	'User' => array(
    		'id' => '1',
    		'username' => 'mark',
    		'Role' => array(
    			(int) 0 => array(
    				'id' => '1',
    				'alias' => 'Superadmin',
    				'RolesUser' => array(
    					'id' => '1',
    					'role_id' => '1',
    					'user_id' => '1'
    				)
    			),
    			(int) 1 => array(
    				'id' => '2',
    				'alias' => 'Owner',
    				'RolesUser' => array(
    					'id' => '2',
    					'role_id' => '2',
    					'user_id' => '1'
    				)
    			)
    		)
    	)
    )
     
  3. Mark

    February 24, 2014 at 20:20

    How does your acl.ini look like?
    Did you try to debug the TinyAuth class where exactly it breaks?
    Also make sure you are using the current master (head).

     
  4. Mark

    February 24, 2014 at 21:04

    Hi Mark,

    Thanks for such a quick response!

    I have tried fiddling with the ini quite a bit, it currently looks like this:

    [People]
    * = Superadmin
     
    [Companies]
    * = Superadmin
    index = *

    I downloaded your whole Tools plugin from github just today, so presumably it is the most recent version.

    I have been debugging the TinyAuthorize.php file, trying to figure out where it gets to. I got as far as debugging the $iniArray var (which contained my ini statements), and $availableRoles which contains all the roles in my database.

    I will try some more debugging tomorrow.

    Many thanks again,
    Mark

     
  5. Mark

    February 25, 2014 at 10:34

    You seem to have a multi-role setup (instead of a single belongsTo relation, did you configure Tiny appropriately?

    Note that there is a test case that seems to proof that your exact array setup in the session should work just fine.
    Maybe you can write test case that disproves that?