[Jifty-commit] r1220 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Jun 8 17:48:08 EDT 2006
Author: alexmv
Date: Thu Jun 8 17:48:07 2006
New Revision: 1220
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Web.pm
Log:
r13729 at zoq-fot-pik: chmrr | 2006-06-08 17:23:34 -0400
* Storing the whole current_user object in the session means that it
caches the user_object across requests, meaning that checks on
current_user get incorrectly cached. This shifts to storing the id
and class of the user object in the database instead. Note that this
will LOG OUT ALL USERS upon upgrade.
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Thu Jun 8 17:48:07 2006
@@ -159,14 +159,18 @@
my $self = shift;
if (@_) {
my $user = shift;
- $self->session->set('user' => $user);
+ $self->session->set('user_id' => $user->id);
+ $self->session->set('user_ref' => ref $user->user_object);
}
if (defined $self->temporary_current_user) {
return $self->temporary_current_user;
- } elsif ($self->session->get('user')) {
- return $self->session->get('user');
- }
- else {
+ } elsif (my $id = $self->session->get('user_id')) {
+ my $object = (Jifty->config->framework('ApplicationClass')."::CurrentUser")->new();
+ my $user = $self->session->get('user_ref')->new( current_user => $object );
+ $user->load_by_cols( id => $id );
+ $object->user_object($user);
+ return $object;
+ } else {
my $object = (Jifty->config->framework('ApplicationClass')."::CurrentUser")->new();
$object->is_superuser(1) if Jifty->config->framework('AdminMode');
return ($object);
More information about the Jifty-commit
mailing list