Added auto_update feature - for updating user information on checkin -
Jay Kuri [Tue, 9 Oct 2007 19:48:12 +0000 (19:48 +0000)]
and checking that the store can auto_create and auto_update when requested

lib/Catalyst/Plugin/Authentication/Realm.pm

index b6ed636..d9ec742 100644 (file)
@@ -88,9 +88,13 @@ sub find_user {
 
     my $res = $self->store->find_user($authinfo, $c);
     
-    if (!$res && $self->config->{'auto_create'} ) {
-        $res = $self->store->auto_create($authinfo, $c);
-    }
+    if (!$res) {
+      if ($self->config->{'auto_create'} && $self->store->can('auto_create') ) {
+          $res = $self->store->auto_create($authinfo, $c);
+      }
+    } elsif ($self->config->{'auto_update'} && $self->store->can('auto_update')) {
+        $res = $self->store->auto_update($authinfo, $c);
+    } 
     
     return $res;
 }