Thursday, January 29, 2009

Re: AuthComponent doesn't work with scaffolding!

The "prettier" way to solve this would be to use cake's `bake`
application to create all of the methods in a scaffolded way. The
issue here is that if you decide to reconstruct your database and/or
model, you'd have to delete your cache files *and* re-bake your
controller and view files. However, for the most part, scaffolding
was (by convention) thought of as a testing tool to help you get
started to show a framework for how the application could behave and
interact. It wasn't really meant as a way to run the code in
production. Adding the Auth component, which is more of a production
ready tool to something that was simply meant for testing...

You'd want to suggest your patch to Trac via an enhancement ticket
(unless you can write a unit test somewhere to prove it as a bug) if
you feel that certain projects will require the use of dynamic
scaffolding.

On Jan 29, 8:56 am, JuniorCMS <marco.pegor...@gmail.com> wrote:
> Hi,
>
> I'm in truble with AuthComponent 'cause i want to use scaffolding for
> simple tasks but I need to restrict access to the application.
>
> Diving into the source I found the point o problem in the
> AuthComponent source file (/cake/libs/controllers/components/auth.php
> #265).
>
> Inizialization check actual action request against controller's
> methods list: if you're using scaffolding like me your methods list is
> blank!
>
> My solution is to introduce this code to AppController:
>
> -------
> function __construct() { parent::__construct();
>         if ( empty($this->methods) ) $this->methods = array();
>         $this->methods = array_merge( $this->methods, array('index', 'list',
> 'view', 'add', 'create', 'edit', 'update', 'delete') );}
>
> -------
>
> This code add some default methods to the controller's methods list so
> Auth can work propelly!
>
> I'm looking for a pretty way to solve this problem!
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: