Re: Different Admin routing based on a role field

2009-10-06 Thread Bidibule

Thanks I'll try !

On 5 oct, 18:50, vekija vedran.konto...@gmail.com wrote:
 add this to your router file

      Router::connect('/user/:controller/:action/*', array('prefix' =
 'user', 'user' = true));

 this will require your actions in the controller to be prefixed as
 well.

 In case you want to share actions between the roles but have separate
 views, you can add a custom parameter as prefix (note the word
 myprefix instead of prefix in the params array)

     Router::connect('/user/:controller/:action/*', array('myprefix' =
 'user'));
     Router::connect('/admin/:controller/:action/*', array('myprefix'
 = 'admin'));

 Then in the beforeFilter you can check for the prefix with $this-

 params['myprefix'] and set the view based on that

 On Oct 5, 4:16 pm, Bidibule bblamp...@tagexpert.be wrote:

  Hi all!

  I'm in trouble guys !  :)

  I want to make differents admin routing based on the user role.
  Mainly, I have 2 roles : admin and logged user

  So no problem about using Auth Component and the 'admin' prefix for my
  views. (admin_index eg)
  But I think it will be cool to have another prefix for a different
  role like 'user_index' for the logged user.

  So I could easily organize my view based on a prefix.

  But right now I think cake juste allow one admin routing and one
  prefix so anyone have an idea to do that ?
  In the beforeFilter method ?

  Thanks for helping !


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Different Admin routing based on a role field

2009-10-05 Thread Bidibule

Hi all!

I'm in trouble guys !  :)

I want to make differents admin routing based on the user role.
Mainly, I have 2 roles : admin and logged user

So no problem about using Auth Component and the 'admin' prefix for my
views. (admin_index eg)
But I think it will be cool to have another prefix for a different
role like 'user_index' for the logged user.

So I could easily organize my view based on a prefix.

But right now I think cake juste allow one admin routing and one
prefix so anyone have an idea to do that ?
In the beforeFilter method ?

Thanks for helping !
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---



Re: Different Admin routing based on a role field

2009-10-05 Thread vekija

add this to your router file

 Router::connect('/user/:controller/:action/*', array('prefix' =
'user', 'user' = true));

this will require your actions in the controller to be prefixed as
well.

In case you want to share actions between the roles but have separate
views, you can add a custom parameter as prefix (note the word
myprefix instead of prefix in the params array)

Router::connect('/user/:controller/:action/*', array('myprefix' =
'user'));
Router::connect('/admin/:controller/:action/*', array('myprefix'
= 'admin'));

Then in the beforeFilter you can check for the prefix with $this-
params['myprefix'] and set the view based on that

On Oct 5, 4:16 pm, Bidibule bblamp...@tagexpert.be wrote:
 Hi all!

 I'm in trouble guys !  :)

 I want to make differents admin routing based on the user role.
 Mainly, I have 2 roles : admin and logged user

 So no problem about using Auth Component and the 'admin' prefix for my
 views. (admin_index eg)
 But I think it will be cool to have another prefix for a different
 role like 'user_index' for the logged user.

 So I could easily organize my view based on a prefix.

 But right now I think cake juste allow one admin routing and one
 prefix so anyone have an idea to do that ?
 In the beforeFilter method ?

 Thanks for helping !
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~--~~~~--~~--~--~---