If !use_userdata_from_session, only store PK cols in the hashref that goes in the...
Andrew Rodland [Fri, 17 Jun 2011 15:39:14 +0000 (15:39 +0000)]
lib/Catalyst/Authentication/Store/DBIx/Class/User.pm

index 7a78a7b..dddcdaa 100644 (file)
@@ -165,7 +165,14 @@ sub for_session {
     #return $frozenuser;
 
     my %userdata = $self->_user->get_columns();
-    return \%userdata;
+
+    # If use_userdata_from_session is set, then store all of the columns of the user obj in the session
+    if (exists($self->config->{'use_userdata_from_session'}) && $self->config->{'use_userdata_from_session'} != 0) {
+        return \%userdata;
+    } else { # Otherwise, we just need the PKs for load() to use.
+        my %pk_fields = map { ($_ => $userdata{$_}) } @{ $self->config->{id_field} };
+        return \%pk_fields;
+    }
 }
 
 sub from_session {