[Catalyst-commits] r14041 - Catalyst-Authentication-Store-DBIx-Class/branches/no-unneeded-fields/lib/Catalyst/Authentication/Store/DBIx/Class

hobbs at dev.catalyst.perl.org hobbs at dev.catalyst.perl.org
Fri Jun 17 15:39:14 GMT 2011


Author: hobbs
Date: 2011-06-17 15:39:14 +0000 (Fri, 17 Jun 2011)
New Revision: 14041

Modified:
   Catalyst-Authentication-Store-DBIx-Class/branches/no-unneeded-fields/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
Log:
If !use_userdata_from_session, only store PK cols in the hashref that goes in the session


Modified: Catalyst-Authentication-Store-DBIx-Class/branches/no-unneeded-fields/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/branches/no-unneeded-fields/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2011-06-17 15:27:15 UTC (rev 14040)
+++ Catalyst-Authentication-Store-DBIx-Class/branches/no-unneeded-fields/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2011-06-17 15:39:14 UTC (rev 14041)
@@ -165,7 +165,14 @@
     #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 {




More information about the Catalyst-commits mailing list