X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAuthentication%2FStore%2FLDAP%2FBackend.pm;h=59f029987e140eda57c1c4fd31d471ef01ecd6c0;hb=e5e1d261e90dcc1f0e6a055185816c2f1b7735cd;hp=a66da0e7263350b37aba1ee3bc4b5c7b5d510e00;hpb=e0c4eaa2c512a316a689a4a46086e64ef390c9f9;p=catagits%2FCatalyst-Authentication-Store-LDAP.git diff --git a/lib/Catalyst/Authentication/Store/LDAP/Backend.pm b/lib/Catalyst/Authentication/Store/LDAP/Backend.pm index a66da0e..59f0299 100644 --- a/lib/Catalyst/Authentication/Store/LDAP/Backend.pm +++ b/lib/Catalyst/Authentication/Store/LDAP/Backend.pm @@ -452,13 +452,21 @@ sub user_supports { Revives a serialized user from storage in the session. +Supports users stored with a different persist_in_session setting. + =cut sub from_session { my ( $self, $c, $frozenuser ) = @_; - if ( $self->persist_in_session eq 'all' ) { - return $self->user_class->new( $self, $frozenuser->{user}, $c, $frozenuser->{_roles} ); + # we need to restore the user depending on the current storage of the + # user in the session store which might differ from what + # persist_in_session is set to now + if ( ref $frozenuser eq 'HASH' ) { + # we can rely on the existance of this key if the user is a hashref + if ( $frozenuser->{persist_in_session} eq 'all' ) { + return $self->user_class->new( $self, $frozenuser->{user}, $c, $frozenuser->{_roles} ); + } } return $self->get_user( $frozenuser, $c );