Best Way to Organize Controllers for Multiple Roles

3 messages Options
Embed this post
Permalink
lauraw

Best Way to Organize Controllers for Multiple Roles

Reply Threaded More More options
Print post
Permalink

I'm trying to figure out the best way to organize controllers based on
user roles and could use some advice. I know there are experienced
people here who have had to deal with this already :-).

I have controller folders setup as:

member/
manager/
admin/

They all deal with products and I don't want to have one
ProductController at the controllers/ level that has all the functions
(view a product, add a product, delete a product). This is the way I'd
like to set it up:

member/product_controller - view()
manager/product_controller - add()
admin/product_controller - delete()

What is the best way to accomplish this division of controller
functionality? I know that I can modify the paths for controllers in
bootstrap.php, but if I have the same controller under multiple
locations, which one will cake find? The first in the list I assume?
The other solution I was thinking of is to name the controllers
differently, but is this the best way to do it?

mem_product_controller
mgr_product_controller
adm_product_controller

I'm new to CakePHP ... I'm not sure if this is doable with cake's MVC
naming conventions.

Thanks for your help!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Miles J

Re: Best Way to Organize Controllers for Multiple Roles

Reply Threaded More More options
Print post
Permalink

You can't separate controllers into folders like you can in
CodeIgniter/Zend. You would have to use prefixes, which is only
present in 1.3, which is still alpha.

Or you can create separate plugins for each member/manager/admin, but
that becomes too much.

Or you just use 1 controller, and use an ACL type system that
determines what they can and cannot do.

On Nov 5, 7:45 am, lauraw <[hidden email]> wrote:

> I'm trying to figure out the best way to organize controllers based on
> user roles and could use some advice. I know there are experienced
> people here who have had to deal with this already :-).
>
> I have controller folders setup as:
>
> member/
> manager/
> admin/
>
> They all deal with products and I don't want to have one
> ProductController at the controllers/ level that has all the functions
> (view a product, add a product, delete a product). This is the way I'd
> like to set it up:
>
> member/product_controller - view()
> manager/product_controller - add()
> admin/product_controller - delete()
>
> What is the best way to accomplish this division of controller
> functionality? I know that I can modify the paths for controllers in
> bootstrap.php, but if I have the same controller under multiple
> locations, which one will cake find? The first in the list I assume?
> The other solution I was thinking of is to name the controllers
> differently, but is this the best way to do it?
>
> mem_product_controller
> mgr_product_controller
> adm_product_controller
>
> I'm new to CakePHP ... I'm not sure if this is doable with cake's MVC
> naming conventions.
>
> Thanks for your help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

lauraw

Re: Best Way to Organize Controllers for Multiple Roles

Reply Threaded More More options
Print post
Permalink

I'm going to be implemented/learning ACL as part of this project so
I'll go that route. Thanks, Miles!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---