Re: Accessing auth information from within model class

2009-06-08 Thread Miles J

Its because you cant use components in models. If you want to access
the session, you would have to import it.

App::import('Component', 'Session');
$Session = new SessionComponent();

$auth = $Session->read('Auth.User');
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Accessing auth information from within model class

2009-06-08 Thread Bryan Paddock
Hey all,
I can't seem to find out how to access the Auth class from within the model?

I have models/property.php where in the afterfind() function I need to
perform certain functions based on the user_id if the user is logged in.

$this->Auth->user() is not within the scope.

I can't use $this->Session either.

Any ideas on how I can access either of them?

thanks!

Bryan

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---