Thanks very much, I'll give it a shot! :)

On Tue, Jul 7, 2009 at 10:01 AM, Robert P<[email protected]> wrote:
>
> I recently had a problem very similar to this, but it may not have
> been the same. Anyway, here's my explanation and solution:
>
> AuthComponent was not creating an instance of AclComponent to use at
> AuthComponent::$Acl.
>
> To fix this I added the following function to AppController:
>
>        function _initAuthAcl() {
>                if (!isset($this->Auth->Acl)) {
>                        $this->Auth->Acl =& $this->Acl;
>                }
>        }
>
> And call it from AppController::beforeFilter():
>
>        function beforeFilter() {
>                /* AuthComponent configuration */
>                $this->_initAuthAcl();
>        }
>
> And finally when you're overriding a callback don't forget to call the
> original. So, in your normal controllers:
>
>        function beforeFilter() {
>                parent:beforeFilter();
>                $this->Auth->allow('add', 'index', 'login','logout');
>        }
>
> This solution was very specific to my problem, but I hope it helps.
>
>
> On Jul 7, 3:34 pm, Taff <[email protected]> wrote:
>> In my AppController I have
>>
>> <?php
>> class AppController extends Controller {
>>     var $components = array('Acl', 'Auth');
>>
>>     function beforeFilter() {
>>         //Configure AuthComponent
>>         $this->Auth->authorize = 'actions';
>>         $this->Auth->loginAction = array('controller' => 'users',
>> 'action' => 'login');
>>         $this->Auth->logoutRedirect = array('controller' => 'users',
>> 'action' => 'login');
>>         $this->Auth->loginRedirect = array('controller' => 'posts',
>> 'action' => 'add');
>>     }
>>
>> }
>>
>> ?>
>>
>> which I was under the impression would make the components available
>> in all the controllers I am using in the app.
>>
>>         function beforeFilter() {
>>                 $this->Auth->allow('add', 'index', 'login','logout');
>>         }
>>
>> in a controller however gives me the "Call to a member function on a
>> non-object" error unless I add
>> var $components = array('Acl', 'Auth');
>>
>> to that controller too, which obviously isn't much of a problem, but I
>> would like to understand why, as I am very new to cakePHP and would
>> like to understand why.
>>
>> Thanks for any pointers!
>> Taff
>
> >
>



-- 
______________________________

Adrian Lawley

Web-Entwicklung
Web Development & Design

-    Breiter Weg 24, 31787 Hameln
-    Tel: +49 (05151) 96 45 40

-    e-mail: [email protected]
-    url: http://www.adrianlawley.com/

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

Reply via email to