On Sunday, 13 January 2013 02:42:53 UTC+1, Stefano Campanella wrote:
>
> I'm using the datasources plugin, but it is not used in this particular 
> controller nor in any class that is loaded there.
>
I was referring to the location of your User model.
 

> I tried to load the class using loadModel() instead but the result is the 
> same.
>
> What I am doing is loading a model only if the user is not authenticated, 
> to check that this particular controller action is allowed to be used by 
> anonymous users. 
>
You're describing another authorization handler
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#authorization
 

> I don't need to have it always loaded
>
Putting a model in your $uses array makes it _available_ to be used from 
where it is setup on first use - it doesn't eagerly load the model.
 

> , since when the used is logged in normal Auth component executes and 
> checks permissions.
>
Your're spreading your auth logic around =)
 

> And anyway putting the class in the uses array doesn't work because 
> controller classes are loaded after the beforeFilter() from what I read in 
> the dispatcher code.
>
That's logically impossible since the beforeFilter is IN the controller 
class.
 

> It seems so strange that models are not loaded in a callback that is used 
> so often.
>
One thing I noticed is that if I rename the model filename from User.php to 
> user.php them the model is loaded correctly...but this goes against the 
> conventions as far as I know.
>

Sounds like you've got code problems - show code for the chance of someone 
pointing at the problem.

AD

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to