Thursday, January 29, 2009

AuthComponent doesn't work with scaffolding!

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: