Re: $this->Auth->user() cached? - Cake 1.2

2008-05-22 Thread Stephen Orr

Basically, it looks like the Auth data is not refreshed on each page
load. I can understand why you wouldn't want to do this - performance
notwithstanding - but I've run into a few issues with it myself
(primarily dealing with having an online store where the customer
could change their email address, etc - all stored in the session, so
it didn't actually update when they saved the changes).

There's probably an alternate solution, I'm thinking somewhere along
the lines of forcing a fresh check against the database every time the
page is loaded. Maybe from AppController::beforeFilter(), for example.
No idea what form that would take yet though.

On May 22, 5:55 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> On Thu, May 22, 2008 at 11:28 AM, theandystratton
>
> <[EMAIL PROTECTED]> wrote:
>
> >> I don't understand what you're trying to do here. Are you trying to
> >> refresh the $user variable or the data in the session?
>
> > I'm trying to find an easy way to refresh the data held in $this->Auth-
> >>user()
>
> But you're assigning *from* Auth, not *to* it.
>
> > is that just pointing to the "User" value in the session?
> > I'm not sure how the Auth object maps to the values in the Session.
>
> Yes, Look at the source for Auth::user(). It's grabbing it from the session.
>
> Strangely though, I'm suddenly seeing an eerily similar problem in my
> own app :-/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this->Auth->user() cached? - Cake 1.2

2008-05-22 Thread b logica

On Thu, May 22, 2008 at 11:28 AM, theandystratton
<[EMAIL PROTECTED]> wrote:
>
>> I don't understand what you're trying to do here. Are you trying to
>> refresh the $user variable or the data in the session?
>
> I'm trying to find an easy way to refresh the data held in $this->Auth-
>>user()

But you're assigning *from* Auth, not *to* it.

> is that just pointing to the "User" value in the session?
> I'm not sure how the Auth object maps to the values in the Session.

Yes, Look at the source for Auth::user(). It's grabbing it from the session.

Strangely though, I'm suddenly seeing an eerily similar problem in my
own app :-/

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this->Auth->user() cached? - Cake 1.2

2008-05-22 Thread theandystratton

> I don't understand what you're trying to do here. Are you trying to
> refresh the $user variable or the data in the session?

I'm trying to find an easy way to refresh the data held in $this->Auth-
>user() -- is that just pointing to the "User" value in the session?
I'm not sure how the Auth object maps to the values in the Session.

-Andy

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $this->Auth->user() cached? - Cake 1.2

2008-05-21 Thread b logica

On Wed, May 21, 2008 at 5:00 PM, theandystratton
<[EMAIL PROTECTED]> wrote:
>
> Just wondering if the array of data return from $this->Auth->user() is
> cached (either on disk or session) by default?
>
> When creating an admin screen to update some fields the user model
> returned from $this->Auth->user() was not updated.

You'll need to update whatever data is held in the session. It's just
an array of data, not a reference to an object or something like that.
After you update the model do something like:

$this->Session->write('User', $user['User']);

> If so, is there a quick way to refresh? My current fix:
>
> $user = $this->User->findByUserId( $this->Auth->user('user_id') );
>
> But that seems a bit clunky... ?
>
I don't understand what you're trying to do here. Are you trying to
refresh the $user variable or the data in the session?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



$this->Auth->user() cached? - Cake 1.2

2008-05-21 Thread theandystratton

Just wondering if the array of data return from $this->Auth->user() is
cached (either on disk or session) by default?

When creating an admin screen to update some fields the user model
returned from $this->Auth->user() was not updated.

If so, is there a quick way to refresh? My current fix:

$user = $this->User->findByUserId( $this->Auth->user('user_id') );

But that seems a bit clunky... ?

-Andy

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---