X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FAuthentication%2FStore%2FMinimal%2FBackend.pm;h=e8ae826cd46eda679e8fb3806aaca5100a8b0631;hb=96777f3a56bb890459c5f41ac9ae7650adb2007b;hp=7bb0a1cfef075e378c1724a1d8113ffce18d0863;hpb=01c50dd64b238fac19a02830456c2d011b435ee0;p=catagits%2FCatalyst-Plugin-Authentication.git diff --git a/lib/Catalyst/Plugin/Authentication/Store/Minimal/Backend.pm b/lib/Catalyst/Plugin/Authentication/Store/Minimal/Backend.pm index 7bb0a1c..e8ae826 100644 --- a/lib/Catalyst/Plugin/Authentication/Store/Minimal/Backend.pm +++ b/lib/Catalyst/Plugin/Authentication/Store/Minimal/Backend.pm @@ -14,6 +14,14 @@ sub new { bless { hash => $hash }, $class; } +sub from_session { + my ( $self, $c, $id ) = @_; + + return $id if ref $id; + + $self->get_user( $id ); +} + sub get_user { my ( $self, $id ) = @_; @@ -23,9 +31,13 @@ sub get_user { if ( ref $user ) { if ( Scalar::Util::blessed($user) ) { + $user->store( $self ); + $user->id( $id ); return $user; } elsif ( ref $user eq "HASH" ) { + $user->{store} = $self; + $user->{id} = $id; return bless $user, "Catalyst::Plugin::Authentication::User::Hash"; } else {