[Catalyst-commits] r14045 - in Catalyst-Authentication-Store-DBIx-Class/tags: . 0.1501 0.1501/lib/Catalyst/Authentication/Store/DBIx 0.1501/lib/Catalyst/Authentication/Store/DBIx/Class

hobbs at dev.catalyst.perl.org hobbs at dev.catalyst.perl.org
Fri Jun 17 16:12:39 GMT 2011


Author: hobbs
Date: 2011-06-17 16:12:39 +0000 (Fri, 17 Jun 2011)
New Revision: 14045

Added:
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/.gitignore
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Changes
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/MANIFEST.SKIP
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Makefile.PL
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class.pm
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/t/
Removed:
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/.gitignore
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Changes
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/MANIFEST.SKIP
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Makefile.PL
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class.pm
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
   Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/t/
Log:
tag 0.1501


Deleted: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/.gitignore
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/.gitignore	2011-06-17 16:03:55 UTC (rev 14043)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/.gitignore	2011-06-17 16:12:39 UTC (rev 14045)
@@ -1,15 +0,0 @@
-.*
-!.gitignore
-Makefile*
-!Makefile.PL
-META.yml
-blib
-build
-inc
-pm_to_blib
-MANIFEST*
-!MANIFEST.SKIP
-Debian*
-README
-Catalyst-Authentication-Store-DBIx-Class-*
-*.bs

Copied: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/.gitignore (from rev 14039, Catalyst-Authentication-Store-DBIx-Class/trunk/.gitignore)
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/.gitignore	                        (rev 0)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/.gitignore	2011-06-17 16:12:39 UTC (rev 14045)
@@ -0,0 +1,15 @@
+.*
+!.gitignore
+Makefile*
+!Makefile.PL
+META.yml
+blib
+build
+inc
+pm_to_blib
+MANIFEST*
+!MANIFEST.SKIP
+Debian*
+README
+Catalyst-Authentication-Store-DBIx-Class-*
+*.bs

Deleted: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Changes
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/Changes	2011-06-17 16:03:55 UTC (rev 14043)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Changes	2011-06-17 16:12:39 UTC (rev 14045)
@@ -1,80 +0,0 @@
-Revision history for Catalyst-Plugin-Authentication-Store-DBIx-Class
-
-        * If use_userdata_from_session isn't set, then don't store more
-          fields than we need in the session -- only the fields we need to
-          load the object from the DB again.
-
-0.1500  2010-11-16
-        * Allow specifying a fully loaded DBIC result in addition to resultsets
-          of which only the first row is considered.
-
-0.1401  2010-11-16
-        * Fix call to ->load which was not passing $c
-
-0.1400  2010-09-01
-        * Make can() work as well as AUTOLOADing.
-
-0.1300  2010-06-16
-        * Support columns with accessors that aren't the column name.
-        * Fix some documentation typos.
-        * Stop failing horribly when running the tests in parallel.
-        * Default to not running pod tests for users, even if the
-          required modules for that are available.
-
-0.1200  2010-04-10
-        Release 0.1100 as a stable version without further modifications.
-
-0.1100  2010-03-29 - development release
-        Support compound primary keys for looking up users.
-
-0.1083  2010-03-03
-        Tweaking exception message to better explain what people did wrong when
-            they pass bad columns to authenticate.
-
-0.1082  2008-10-27
-        Documentation tweak to clarify user_class, store_user_class etc.
-
-0.108   2008-09-25
-        Adding SimpleDB realm to simplify basic auth configuration
-        Changing user_class to user_model, per req. by mst to avoid confusing newbies.
-
-0.107   2008-09-29
-        Fix the typo in exception during authenticate
-        Doc fixes and clarifications
-        Added missing dependency on Catalyst::Model::DBIC::Schema to Makefile.PL
-
-
-0.105   2008-03-19
-        Throw an exception if no fields are provided during authenticate
-           - better than retrieving a random user.
-           - still possible to do an empty search by using searchargs
-
-0.104   2008-02-15
-        Added ability to avoid DB hits when restoring from session
-
-0.103   2008-02-07
-        Added missing DBIx::Class dependancy in Makefile.PL so
-        that the damn test bots stop emailing me.
-
-0.102   2008-01-23
-        Catalyst::Authentication::Store::DBIx::Class::User
-          - Explicitly call auto_create() against resultset()
-          - Explicitly call auto_update() against _user()
-          - Document the above
-
-0.101   2007-12-02
-        Implemented basic auto_update_user and auto_create_user support
-
-0.10    2007-07-07 3pm CST
-        Proper handling of missing id_field config (load from primary_key)
-        Throw exception if id_field specified does not exist
-        Full test suite added.  (based loosely on old DBIC store)
-
-0.03    XXX
-        Switch to Module::Install
-
-0.02    2006-12-16 2pm CST
-        Rewritten to use proper accessors and clean up to match updated C::P::Authentication class naming
-
-0.01    2006-11-10
-        First version, worked internally, completely undocumented

Copied: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Changes (from rev 14044, Catalyst-Authentication-Store-DBIx-Class/trunk/Changes)
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Changes	                        (rev 0)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Changes	2011-06-17 16:12:39 UTC (rev 14045)
@@ -0,0 +1,81 @@
+Revision history for Catalyst-Plugin-Authentication-Store-DBIx-Class
+
+0.1501  2011-06-17
+        * If use_userdata_from_session isn't set, then don't store more
+          fields than we need in the session -- only the fields we need to
+          load the object from the DB again.
+
+0.1500  2010-11-16
+        * Allow specifying a fully loaded DBIC result in addition to resultsets
+          of which only the first row is considered.
+
+0.1401  2010-11-16
+        * Fix call to ->load which was not passing $c
+
+0.1400  2010-09-01
+        * Make can() work as well as AUTOLOADing.
+
+0.1300  2010-06-16
+        * Support columns with accessors that aren't the column name.
+        * Fix some documentation typos.
+        * Stop failing horribly when running the tests in parallel.
+        * Default to not running pod tests for users, even if the
+          required modules for that are available.
+
+0.1200  2010-04-10
+        Release 0.1100 as a stable version without further modifications.
+
+0.1100  2010-03-29 - development release
+        Support compound primary keys for looking up users.
+
+0.1083  2010-03-03
+        Tweaking exception message to better explain what people did wrong when
+            they pass bad columns to authenticate.
+
+0.1082  2008-10-27
+        Documentation tweak to clarify user_class, store_user_class etc.
+
+0.108   2008-09-25
+        Adding SimpleDB realm to simplify basic auth configuration
+        Changing user_class to user_model, per req. by mst to avoid confusing newbies.
+
+0.107   2008-09-29
+        Fix the typo in exception during authenticate
+        Doc fixes and clarifications
+        Added missing dependency on Catalyst::Model::DBIC::Schema to Makefile.PL
+
+
+0.105   2008-03-19
+        Throw an exception if no fields are provided during authenticate
+           - better than retrieving a random user.
+           - still possible to do an empty search by using searchargs
+
+0.104   2008-02-15
+        Added ability to avoid DB hits when restoring from session
+
+0.103   2008-02-07
+        Added missing DBIx::Class dependancy in Makefile.PL so
+        that the damn test bots stop emailing me.
+
+0.102   2008-01-23
+        Catalyst::Authentication::Store::DBIx::Class::User
+          - Explicitly call auto_create() against resultset()
+          - Explicitly call auto_update() against _user()
+          - Document the above
+
+0.101   2007-12-02
+        Implemented basic auto_update_user and auto_create_user support
+
+0.10    2007-07-07 3pm CST
+        Proper handling of missing id_field config (load from primary_key)
+        Throw exception if id_field specified does not exist
+        Full test suite added.  (based loosely on old DBIC store)
+
+0.03    XXX
+        Switch to Module::Install
+
+0.02    2006-12-16 2pm CST
+        Rewritten to use proper accessors and clean up to match updated C::P::Authentication class naming
+
+0.01    2006-11-10
+        First version, worked internally, completely undocumented

Deleted: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/MANIFEST.SKIP
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/MANIFEST.SKIP	2011-06-17 16:03:55 UTC (rev 14043)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/MANIFEST.SKIP	2011-06-17 16:12:39 UTC (rev 14045)
@@ -1,33 +0,0 @@
-# Avoid version control files.
-\bRCS\b
-\bCVS\b
-,v$
-\B\.svn\b
-\B\.git\b
-
-# Avoid Makemaker generated and utility files.
-\bMakefile$
-\bblib
-\bMakeMaker-\d
-\bpm_to_blib$
-\bblibdirs$
-^MANIFEST\.SKIP$
-
-# Avoid Module::Build generated and utility files.
-\bBuild$
-\b_build
-
-# Avoid temp and backup files.
-~$
-\.tmp$
-\.old$
-\.bak$
-\#$
-\b\.#
-^..*\.sw[po]$
-
-\.DS_Store$
-\.tar\.gz$
-
-# Module::Bane
-\bBuild.PL$

Copied: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/MANIFEST.SKIP (from rev 14039, Catalyst-Authentication-Store-DBIx-Class/trunk/MANIFEST.SKIP)
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/MANIFEST.SKIP	                        (rev 0)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/MANIFEST.SKIP	2011-06-17 16:12:39 UTC (rev 14045)
@@ -0,0 +1,33 @@
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+,v$
+\B\.svn\b
+\B\.git\b
+
+# Avoid Makemaker generated and utility files.
+\bMakefile$
+\bblib
+\bMakeMaker-\d
+\bpm_to_blib$
+\bblibdirs$
+^MANIFEST\.SKIP$
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build
+
+# Avoid temp and backup files.
+~$
+\.tmp$
+\.old$
+\.bak$
+\#$
+\b\.#
+^..*\.sw[po]$
+
+\.DS_Store$
+\.tar\.gz$
+
+# Module::Bane
+\bBuild.PL$

Deleted: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Makefile.PL
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL	2011-06-17 16:03:55 UTC (rev 14043)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Makefile.PL	2011-06-17 16:12:39 UTC (rev 14045)
@@ -1,53 +0,0 @@
-use inc::Module::Install 0.91;
-
-if( -e 'MANIFEST.SKIP' ) {
-    system( 'pod2text lib/Catalyst/Authentication/Store/DBIx/Class.pm > README' );
-}
-realclean_files 'README';
-
-## I'd love to use can_use - but I can't seem to test for success. :-/
-eval { require Catalyst::Plugin::Authentication::Store::DBIx::Class or die 'footy'; };
-
-if (!$@) {   #} can_use("Catalyst::Plugin::Authentication::Store::DBIx::Class") ) {
-    print STDERR <<EOM;
-*******************************************
-***  WARNING:  DEPRECATED MODULE FOUND  ***
-*******************************************
-
-You have the Catalyst::Plugin::Authentication::Store::DBIx::Class installed.
-The module you are installing supercedes it and it's presence has been known
-to cause conflicts.   We STRONGLY recommend you remove the old module before
-proceeding.
-
-You can use CPANPLUS (the cpanp command) to remove the module.
-
-You have 5 seconds to abort this install to remove the old module.
-EOM
-    sleep 5;
-    print STDERR "Ok. Proceeding anyway...\n\nYou are entering a dimension not only of sight and sound, but of mind...\n\n";
-}
-
-
-name 'Catalyst-Authentication-Store-DBIx-Class';
-all_from 'lib/Catalyst/Authentication/Store/DBIx/Class.pm';
-
-perl_version '5.8.1';
-
-requires (
-    'Catalyst::Runtime'                 => '5.8',
-    'Catalyst::Plugin::Authentication'  => '0.10008',
-    'Catalyst::Model::DBIC::Schema'     => '0.18',
-    'DBIx::Class'                       => '0.08',
-    'Moose'                             => 0,
-    'namespace::autoclean'              => 0,
-    'List::MoreUtils'                   => 0,
-    'Try::Tiny'                         => 0,
-);
-
-test_requires 'Test::More';
-
-resources repository => 'http://dev.catalystframework.org/repos/Catalyst/Catalyst-Authentication-Store-DBIx-Class';
-
-auto_install;
-auto_provides;
-WriteAll;

Copied: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Makefile.PL (from rev 14039, Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL)
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Makefile.PL	                        (rev 0)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/Makefile.PL	2011-06-17 16:12:39 UTC (rev 14045)
@@ -0,0 +1,53 @@
+use inc::Module::Install 0.91;
+
+if( -e 'MANIFEST.SKIP' ) {
+    system( 'pod2text lib/Catalyst/Authentication/Store/DBIx/Class.pm > README' );
+}
+realclean_files 'README';
+
+## I'd love to use can_use - but I can't seem to test for success. :-/
+eval { require Catalyst::Plugin::Authentication::Store::DBIx::Class or die 'footy'; };
+
+if (!$@) {   #} can_use("Catalyst::Plugin::Authentication::Store::DBIx::Class") ) {
+    print STDERR <<EOM;
+*******************************************
+***  WARNING:  DEPRECATED MODULE FOUND  ***
+*******************************************
+
+You have the Catalyst::Plugin::Authentication::Store::DBIx::Class installed.
+The module you are installing supercedes it and it's presence has been known
+to cause conflicts.   We STRONGLY recommend you remove the old module before
+proceeding.
+
+You can use CPANPLUS (the cpanp command) to remove the module.
+
+You have 5 seconds to abort this install to remove the old module.
+EOM
+    sleep 5;
+    print STDERR "Ok. Proceeding anyway...\n\nYou are entering a dimension not only of sight and sound, but of mind...\n\n";
+}
+
+
+name 'Catalyst-Authentication-Store-DBIx-Class';
+all_from 'lib/Catalyst/Authentication/Store/DBIx/Class.pm';
+
+perl_version '5.8.1';
+
+requires (
+    'Catalyst::Runtime'                 => '5.8',
+    'Catalyst::Plugin::Authentication'  => '0.10008',
+    'Catalyst::Model::DBIC::Schema'     => '0.18',
+    'DBIx::Class'                       => '0.08',
+    'Moose'                             => 0,
+    'namespace::autoclean'              => 0,
+    'List::MoreUtils'                   => 0,
+    'Try::Tiny'                         => 0,
+);
+
+test_requires 'Test::More';
+
+resources repository => 'http://dev.catalystframework.org/repos/Catalyst/Catalyst-Authentication-Store-DBIx-Class';
+
+auto_install;
+auto_provides;
+WriteAll;

Deleted: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2011-06-08 22:35:52 UTC (rev 14039)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2011-06-17 16:12:39 UTC (rev 14045)
@@ -1,394 +0,0 @@
-package Catalyst::Authentication::Store::DBIx::Class::User;
-
-use Moose;
-use namespace::autoclean;
-extends 'Catalyst::Authentication::User';
-
-use List::MoreUtils 'all';
-use Try::Tiny;
-
-has 'config'    => (is => 'rw');
-has 'resultset' => (is => 'rw');
-has '_user'     => (is => 'rw');
-has '_roles'    => (is => 'rw');
-
-sub new {
-    my ( $class, $config, $c) = @_;
-
-	$config->{user_model} = $config->{user_class}
-        unless defined $config->{user_model};
-
-    my $self = {
-        resultset => $c->model($config->{'user_model'}),
-        config => $config,
-        _roles => undef,
-        _user => undef
-    };
-
-    bless $self, $class;
-
-    Catalyst::Exception->throw(
-        "\$c->model('${ \$self->config->{user_model} }') did not return a resultset."
-          . " Did you set user_model correctly?"
-    ) unless $self->{resultset};
-
-    $self->config->{'id_field'} = [$self->{'resultset'}->result_source->primary_columns]
-        unless exists $self->config->{'id_field'};
-
-    $self->config->{'id_field'} = [$self->config->{'id_field'}]
-        unless ref $self->config->{'id_field'} eq 'ARRAY';
-
-    Catalyst::Exception->throw(
-        "id_field set to "
-          . join(q{,} => @{ $self->config->{'id_field'} })
-          . " but user table has no column by that name!"
-    ) unless all { $self->{'resultset'}->result_source->has_column($_) } @{ $self->config->{'id_field'} };
-
-    ## if we have lazyloading turned on - we should not query the DB unless something gets read.
-    ## that's the idea anyway - still have to work out how to manage that - so for now we always force
-    ## lazyload to off.
-    $self->config->{lazyload} = 0;
-
-#    if (!$self->config->{lazyload}) {
-#        return $self->load_user($authinfo, $c);
-#    } else {
-#        ## what do we do with a lazyload?
-#        ## presumably this is coming out of session storage.
-#        ## use $authinfo to fill in the user in that case?
-#    }
-
-    return $self;
-}
-
-
-sub load {
-    my ($self, $authinfo, $c) = @_;
-
-    my $dbix_class_config = 0;
-
-    if (exists($authinfo->{'dbix_class'})) {
-        $authinfo = $authinfo->{'dbix_class'};
-        $dbix_class_config = 1;
-    }
-
-    ## User can provide an arrayref containing the arguments to search on the user class.
-    ## or even provide a prepared resultset, allowing maximum flexibility for user retreival.
-    ## these options are only available when using the dbix_class authinfo hash.
-    if ($dbix_class_config && exists($authinfo->{'result'})) {
-	$self->_user($authinfo->{'result'});
-    } elsif ($dbix_class_config && exists($authinfo->{'resultset'})) {
-        $self->_user($authinfo->{'resultset'}->first);
-    } elsif ($dbix_class_config && exists($authinfo->{'searchargs'})) {
-        $self->_user($self->resultset->search(@{$authinfo->{'searchargs'}})->first);
-    } else {
-        ## merge the ignore fields array into a hash - so we can do an easy check while building the query
-        my %ignorefields = map { $_ => 1} @{$self->config->{'ignore_fields_in_find'}};
-        my $searchargs = {};
-
-        # now we walk all the fields passed in, and build up a search hash.
-        foreach my $key (grep {!$ignorefields{$_}} keys %{$authinfo}) {
-            if ($self->resultset->result_source->has_column($key)) {
-                $searchargs->{$key} = $authinfo->{$key};
-            }
-        }
-        if (keys %{$searchargs}) {
-            $self->_user($self->resultset->search($searchargs)->first);
-        } else {
-            Catalyst::Exception->throw(
-                "Failed to load user data.  You passed [" . join(',', keys %{$authinfo}) . "]"
-                  . " to authenticate() but your user source (" .  $self->config->{'user_model'} . ")"
-                  . " only has these columns: [" . join( ",", $self->resultset->result_source->columns ) . "]"
-                  . "   Check your authenticate() call."
-            );
-        }
-    }
-
-    if ($self->get_object) {
-        return $self;
-    } else {
-        return undef;
-    }
-
-}
-
-sub supported_features {
-    my $self = shift;
-
-    return {
-        session         => 1,
-        roles           => 1,
-    };
-}
-
-
-sub roles {
-    my ( $self ) = shift;
-    ## this used to load @wantedroles - but that doesn't seem to be used by the roles plugin, so I dropped it.
-
-    ## shortcut if we have already retrieved them
-    if (ref $self->_roles eq 'ARRAY') {
-        return(@{$self->_roles});
-    }
-
-    my @roles = ();
-    if (exists($self->config->{'role_column'})) {
-        my $role_data = $self->get($self->config->{'role_column'});
-        if ($role_data) {
-            @roles = split /[\s,\|]+/, $self->get($self->config->{'role_column'});
-        }
-        $self->_roles(\@roles);
-    } elsif (exists($self->config->{'role_relation'})) {
-        my $relation = $self->config->{'role_relation'};
-        if ($self->_user->$relation->result_source->has_column($self->config->{'role_field'})) {
-            @roles = map {
-                $_->get_column($self->config->{role_field})
-            } $self->_user->$relation->search(undef, {
-                columns => [ $self->config->{role_field} ]
-            })->all;
-            $self->_roles(\@roles);
-        } else {
-            Catalyst::Exception->throw("role table does not have a column called " . $self->config->{'role_field'});
-        }
-    } else {
-        Catalyst::Exception->throw("user->roles accessed, but no role configuration found");
-    }
-
-    return @{$self->_roles};
-}
-
-sub for_session {
-    my $self = shift;
-
-    #return $self->get($self->config->{'id_field'});
-
-    #my $frozenuser = $self->_user->result_source->schema->freeze( $self->_user );
-    #return $frozenuser;
-
-    my %userdata = $self->_user->get_columns();
-    return \%userdata;
-}
-
-sub from_session {
-    my ($self, $frozenuser, $c) = @_;
-
-    #my $obj = $self->resultset->result_source->schema->thaw( $frozenuser );
-    #$self->_user($obj);
-
-    #if (!exists($self->config->{'use_userdata_from_session'}) || $self->config->{'use_userdata_from_session'} == 0) {
-#        $self->_user->discard_changes();
-#    }
-#
-#    return $self;
-#
-## if use_userdata_from_session is defined in the config, we fill in the user data from the session.
-    if (exists($self->config->{'use_userdata_from_session'}) && $self->config->{'use_userdata_from_session'} != 0) {
-        my $obj = $self->resultset->new_result({ %$frozenuser });
-        $obj->in_storage(1);
-        $self->_user($obj);
-        return $self;
-    }
-
-    if (ref $frozenuser eq 'HASH') {
-        return $self->load({
-            map { ($_ => $frozenuser->{$_}) }
-            @{ $self->config->{id_field} }
-        }, $c);
-    }
-
-    return $self->load( { $self->config->{'id_field'} => $frozenuser }, $c);
-}
-
-sub get {
-    my ($self, $field) = @_;
-
-    if (my $code = $self->_user->can($field)) {
-        return $self->_user->$code;
-    }
-    elsif (my $accessor =
-         try { $self->_user->result_source->column_info($field)->{accessor} }) {
-        return $self->_user->$accessor;
-    } else {
-        # XXX this should probably throw
-        return undef;
-    }
-}
-
-sub get_object {
-    my ($self, $force) = @_;
-
-    if ($force) {
-        $self->_user->discard_changes;
-    }
-
-    return $self->_user;
-}
-
-sub obj {
-    my ($self, $force) = @_;
-
-    return $self->get_object($force);
-}
-
-sub auto_create {
-    my $self = shift;
-    $self->_user( $self->resultset->auto_create( @_ ) );
-    return $self;
-}
-
-sub auto_update {
-    my $self = shift;
-    $self->_user->auto_update( @_ );
-}
-
-sub can {
-    my $self = shift;
-    return $self->SUPER::can(@_) || do {
-        my ($method) = @_;
-        if (my $code = $self->_user->can($method)) {
-            sub { shift->_user->$code(@_) }
-        } elsif (my $accessor =
-            try { $self->_user->result_source->column_info($method)->{accessor} }) {
-            sub { shift->_user->$accessor }
-        } else {
-            undef;
-        }
-    };
-}
-
-sub AUTOLOAD {
-    my $self = shift;
-    (my $method) = (our $AUTOLOAD =~ /([^:]+)$/);
-    return if $method eq "DESTROY";
-
-    if (my $code = $self->_user->can($method)) {
-        return $self->_user->$code(@_);
-    }
-    elsif (my $accessor =
-         try { $self->_user->result_source->column_info($method)->{accessor} }) {
-        return $self->_user->$accessor(@_);
-    } else {
-        # XXX this should also throw
-        return undef;
-    }
-}
-
-__PACKAGE__->meta->make_immutable(inline_constructor => 0);
-
-1;
-__END__
-
-=head1 NAME
-
-Catalyst::Authentication::Store::DBIx::Class::User - The backing user
-class for the Catalyst::Authentication::Store::DBIx::Class storage
-module.
-
-=head1 VERSION
-
-This documentation refers to version 0.1500.
-
-=head1 SYNOPSIS
-
-Internal - not used directly, please see
-L<Catalyst::Authentication::Store::DBIx::Class> for details on how to
-use this module. If you need more information than is present there, read the
-source.
-
-
-
-=head1 DESCRIPTION
-
-The Catalyst::Authentication::Store::DBIx::Class::User class implements user storage
-connected to an underlying DBIx::Class schema object.
-
-=head1 SUBROUTINES / METHODS
-
-=head2 new
-
-Constructor.
-
-=head2 load ( $authinfo, $c )
-
-Retrieves a user from storage using the information provided in $authinfo.
-
-=head2 supported_features
-
-Indicates the features supported by this class.  These are currently Roles and Session.
-
-=head2 roles
-
-Returns an array of roles associated with this user, if roles are configured for this user class.
-
-=head2 for_session
-
-Returns a serialized user for storage in the session.
-
-=head2 from_session
-
-Revives a serialized user from storage in the session.
-
-=head2 get ( $fieldname )
-
-Returns the value of $fieldname for the user in question.  Roughly translates to a call to
-the DBIx::Class::Row's get_column( $fieldname ) routine.
-
-=head2 get_object
-
-Retrieves the DBIx::Class object that corresponds to this user
-
-=head2 obj (method)
-
-Synonym for get_object
-
-=head2 auto_create
-
-This is called when the auto_create_user option is turned on in
-Catalyst::Plugin::Authentication and a user matching the authinfo provided is not found.
-By default, this will call the C<auto_create()> method of the resultset associated
-with this object. It is up to you to implement that method.
-
-=head2 auto_update
-
-This is called when the auto_update_user option is turned on in
-Catalyst::Plugin::Authentication. Note that by default the DBIx::Class store
-uses every field in the authinfo hash to match the user. This means any
-information you provide with the intent to update must be ignored during the
-user search process. Otherwise the information will most likely cause the user
-record to not be found. To ignore fields in the search process, you
-have to add the fields you wish to update to the 'ignore_fields_in_find'
-authinfo element.  Alternately, you can use one of the advanced row retrieval
-methods (searchargs or resultset).
-
-By default, auto_update will call the C<auto_update()> method of the
-DBIx::Class::Row object associated with the user. It is up to you to implement
-that method (probably in your schema file)
-
-=head2 AUTOLOAD
-
-Delegates method calls to the underlieing user row.
-
-=head2 can
-
-Delegates handling of the C<< can >> method to the underlieing user row.
-
-=head1 BUGS AND LIMITATIONS
-
-None known currently, please email the author if you find any.
-
-=head1 AUTHOR
-
-Jason Kuri (jayk at cpan.org)
-
-=head1 CONTRIBUTORS
-
-Matt S Trout (mst) <mst at shadowcat.co.uk>
-
-(fixes wrt can/AUTOLOAD sponsored by L<http://reask.com/>)
-
-=head1 LICENSE
-
-Copyright (c) 2007-2010 the aforementioned authors. All rights
-reserved. This program is free software; you can redistribute
-it and/or modify it under the same terms as Perl itself.
-
-=cut

Copied: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm (from rev 14044, Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm)
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	                        (rev 0)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2011-06-17 16:12:39 UTC (rev 14045)
@@ -0,0 +1,401 @@
+package Catalyst::Authentication::Store::DBIx::Class::User;
+
+use Moose;
+use namespace::autoclean;
+extends 'Catalyst::Authentication::User';
+
+use List::MoreUtils 'all';
+use Try::Tiny;
+
+has 'config'    => (is => 'rw');
+has 'resultset' => (is => 'rw');
+has '_user'     => (is => 'rw');
+has '_roles'    => (is => 'rw');
+
+sub new {
+    my ( $class, $config, $c) = @_;
+
+	$config->{user_model} = $config->{user_class}
+        unless defined $config->{user_model};
+
+    my $self = {
+        resultset => $c->model($config->{'user_model'}),
+        config => $config,
+        _roles => undef,
+        _user => undef
+    };
+
+    bless $self, $class;
+
+    Catalyst::Exception->throw(
+        "\$c->model('${ \$self->config->{user_model} }') did not return a resultset."
+          . " Did you set user_model correctly?"
+    ) unless $self->{resultset};
+
+    $self->config->{'id_field'} = [$self->{'resultset'}->result_source->primary_columns]
+        unless exists $self->config->{'id_field'};
+
+    $self->config->{'id_field'} = [$self->config->{'id_field'}]
+        unless ref $self->config->{'id_field'} eq 'ARRAY';
+
+    Catalyst::Exception->throw(
+        "id_field set to "
+          . join(q{,} => @{ $self->config->{'id_field'} })
+          . " but user table has no column by that name!"
+    ) unless all { $self->{'resultset'}->result_source->has_column($_) } @{ $self->config->{'id_field'} };
+
+    ## if we have lazyloading turned on - we should not query the DB unless something gets read.
+    ## that's the idea anyway - still have to work out how to manage that - so for now we always force
+    ## lazyload to off.
+    $self->config->{lazyload} = 0;
+
+#    if (!$self->config->{lazyload}) {
+#        return $self->load_user($authinfo, $c);
+#    } else {
+#        ## what do we do with a lazyload?
+#        ## presumably this is coming out of session storage.
+#        ## use $authinfo to fill in the user in that case?
+#    }
+
+    return $self;
+}
+
+
+sub load {
+    my ($self, $authinfo, $c) = @_;
+
+    my $dbix_class_config = 0;
+
+    if (exists($authinfo->{'dbix_class'})) {
+        $authinfo = $authinfo->{'dbix_class'};
+        $dbix_class_config = 1;
+    }
+
+    ## User can provide an arrayref containing the arguments to search on the user class.
+    ## or even provide a prepared resultset, allowing maximum flexibility for user retreival.
+    ## these options are only available when using the dbix_class authinfo hash.
+    if ($dbix_class_config && exists($authinfo->{'result'})) {
+	$self->_user($authinfo->{'result'});
+    } elsif ($dbix_class_config && exists($authinfo->{'resultset'})) {
+        $self->_user($authinfo->{'resultset'}->first);
+    } elsif ($dbix_class_config && exists($authinfo->{'searchargs'})) {
+        $self->_user($self->resultset->search(@{$authinfo->{'searchargs'}})->first);
+    } else {
+        ## merge the ignore fields array into a hash - so we can do an easy check while building the query
+        my %ignorefields = map { $_ => 1} @{$self->config->{'ignore_fields_in_find'}};
+        my $searchargs = {};
+
+        # now we walk all the fields passed in, and build up a search hash.
+        foreach my $key (grep {!$ignorefields{$_}} keys %{$authinfo}) {
+            if ($self->resultset->result_source->has_column($key)) {
+                $searchargs->{$key} = $authinfo->{$key};
+            }
+        }
+        if (keys %{$searchargs}) {
+            $self->_user($self->resultset->search($searchargs)->first);
+        } else {
+            Catalyst::Exception->throw(
+                "Failed to load user data.  You passed [" . join(',', keys %{$authinfo}) . "]"
+                  . " to authenticate() but your user source (" .  $self->config->{'user_model'} . ")"
+                  . " only has these columns: [" . join( ",", $self->resultset->result_source->columns ) . "]"
+                  . "   Check your authenticate() call."
+            );
+        }
+    }
+
+    if ($self->get_object) {
+        return $self;
+    } else {
+        return undef;
+    }
+
+}
+
+sub supported_features {
+    my $self = shift;
+
+    return {
+        session         => 1,
+        roles           => 1,
+    };
+}
+
+
+sub roles {
+    my ( $self ) = shift;
+    ## this used to load @wantedroles - but that doesn't seem to be used by the roles plugin, so I dropped it.
+
+    ## shortcut if we have already retrieved them
+    if (ref $self->_roles eq 'ARRAY') {
+        return(@{$self->_roles});
+    }
+
+    my @roles = ();
+    if (exists($self->config->{'role_column'})) {
+        my $role_data = $self->get($self->config->{'role_column'});
+        if ($role_data) {
+            @roles = split /[\s,\|]+/, $self->get($self->config->{'role_column'});
+        }
+        $self->_roles(\@roles);
+    } elsif (exists($self->config->{'role_relation'})) {
+        my $relation = $self->config->{'role_relation'};
+        if ($self->_user->$relation->result_source->has_column($self->config->{'role_field'})) {
+            @roles = map {
+                $_->get_column($self->config->{role_field})
+            } $self->_user->$relation->search(undef, {
+                columns => [ $self->config->{role_field} ]
+            })->all;
+            $self->_roles(\@roles);
+        } else {
+            Catalyst::Exception->throw("role table does not have a column called " . $self->config->{'role_field'});
+        }
+    } else {
+        Catalyst::Exception->throw("user->roles accessed, but no role configuration found");
+    }
+
+    return @{$self->_roles};
+}
+
+sub for_session {
+    my $self = shift;
+
+    #return $self->get($self->config->{'id_field'});
+
+    #my $frozenuser = $self->_user->result_source->schema->freeze( $self->_user );
+    #return $frozenuser;
+
+    my %userdata = $self->_user->get_columns();
+
+    # 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 {
+    my ($self, $frozenuser, $c) = @_;
+
+    #my $obj = $self->resultset->result_source->schema->thaw( $frozenuser );
+    #$self->_user($obj);
+
+    #if (!exists($self->config->{'use_userdata_from_session'}) || $self->config->{'use_userdata_from_session'} == 0) {
+#        $self->_user->discard_changes();
+#    }
+#
+#    return $self;
+#
+## if use_userdata_from_session is defined in the config, we fill in the user data from the session.
+    if (exists($self->config->{'use_userdata_from_session'}) && $self->config->{'use_userdata_from_session'} != 0) {
+        my $obj = $self->resultset->new_result({ %$frozenuser });
+        $obj->in_storage(1);
+        $self->_user($obj);
+        return $self;
+    }
+
+    if (ref $frozenuser eq 'HASH') {
+        return $self->load({
+            map { ($_ => $frozenuser->{$_}) }
+            @{ $self->config->{id_field} }
+        }, $c);
+    }
+
+    return $self->load( { $self->config->{'id_field'} => $frozenuser }, $c);
+}
+
+sub get {
+    my ($self, $field) = @_;
+
+    if (my $code = $self->_user->can($field)) {
+        return $self->_user->$code;
+    }
+    elsif (my $accessor =
+         try { $self->_user->result_source->column_info($field)->{accessor} }) {
+        return $self->_user->$accessor;
+    } else {
+        # XXX this should probably throw
+        return undef;
+    }
+}
+
+sub get_object {
+    my ($self, $force) = @_;
+
+    if ($force) {
+        $self->_user->discard_changes;
+    }
+
+    return $self->_user;
+}
+
+sub obj {
+    my ($self, $force) = @_;
+
+    return $self->get_object($force);
+}
+
+sub auto_create {
+    my $self = shift;
+    $self->_user( $self->resultset->auto_create( @_ ) );
+    return $self;
+}
+
+sub auto_update {
+    my $self = shift;
+    $self->_user->auto_update( @_ );
+}
+
+sub can {
+    my $self = shift;
+    return $self->SUPER::can(@_) || do {
+        my ($method) = @_;
+        if (my $code = $self->_user->can($method)) {
+            sub { shift->_user->$code(@_) }
+        } elsif (my $accessor =
+            try { $self->_user->result_source->column_info($method)->{accessor} }) {
+            sub { shift->_user->$accessor }
+        } else {
+            undef;
+        }
+    };
+}
+
+sub AUTOLOAD {
+    my $self = shift;
+    (my $method) = (our $AUTOLOAD =~ /([^:]+)$/);
+    return if $method eq "DESTROY";
+
+    if (my $code = $self->_user->can($method)) {
+        return $self->_user->$code(@_);
+    }
+    elsif (my $accessor =
+         try { $self->_user->result_source->column_info($method)->{accessor} }) {
+        return $self->_user->$accessor(@_);
+    } else {
+        # XXX this should also throw
+        return undef;
+    }
+}
+
+__PACKAGE__->meta->make_immutable(inline_constructor => 0);
+
+1;
+__END__
+
+=head1 NAME
+
+Catalyst::Authentication::Store::DBIx::Class::User - The backing user
+class for the Catalyst::Authentication::Store::DBIx::Class storage
+module.
+
+=head1 VERSION
+
+This documentation refers to version 0.1501.
+
+=head1 SYNOPSIS
+
+Internal - not used directly, please see
+L<Catalyst::Authentication::Store::DBIx::Class> for details on how to
+use this module. If you need more information than is present there, read the
+source.
+
+
+
+=head1 DESCRIPTION
+
+The Catalyst::Authentication::Store::DBIx::Class::User class implements user storage
+connected to an underlying DBIx::Class schema object.
+
+=head1 SUBROUTINES / METHODS
+
+=head2 new
+
+Constructor.
+
+=head2 load ( $authinfo, $c )
+
+Retrieves a user from storage using the information provided in $authinfo.
+
+=head2 supported_features
+
+Indicates the features supported by this class.  These are currently Roles and Session.
+
+=head2 roles
+
+Returns an array of roles associated with this user, if roles are configured for this user class.
+
+=head2 for_session
+
+Returns a serialized user for storage in the session.
+
+=head2 from_session
+
+Revives a serialized user from storage in the session.
+
+=head2 get ( $fieldname )
+
+Returns the value of $fieldname for the user in question.  Roughly translates to a call to
+the DBIx::Class::Row's get_column( $fieldname ) routine.
+
+=head2 get_object
+
+Retrieves the DBIx::Class object that corresponds to this user
+
+=head2 obj (method)
+
+Synonym for get_object
+
+=head2 auto_create
+
+This is called when the auto_create_user option is turned on in
+Catalyst::Plugin::Authentication and a user matching the authinfo provided is not found.
+By default, this will call the C<auto_create()> method of the resultset associated
+with this object. It is up to you to implement that method.
+
+=head2 auto_update
+
+This is called when the auto_update_user option is turned on in
+Catalyst::Plugin::Authentication. Note that by default the DBIx::Class store
+uses every field in the authinfo hash to match the user. This means any
+information you provide with the intent to update must be ignored during the
+user search process. Otherwise the information will most likely cause the user
+record to not be found. To ignore fields in the search process, you
+have to add the fields you wish to update to the 'ignore_fields_in_find'
+authinfo element.  Alternately, you can use one of the advanced row retrieval
+methods (searchargs or resultset).
+
+By default, auto_update will call the C<auto_update()> method of the
+DBIx::Class::Row object associated with the user. It is up to you to implement
+that method (probably in your schema file)
+
+=head2 AUTOLOAD
+
+Delegates method calls to the underlieing user row.
+
+=head2 can
+
+Delegates handling of the C<< can >> method to the underlieing user row.
+
+=head1 BUGS AND LIMITATIONS
+
+None known currently, please email the author if you find any.
+
+=head1 AUTHOR
+
+Jason Kuri (jayk at cpan.org)
+
+=head1 CONTRIBUTORS
+
+Matt S Trout (mst) <mst at shadowcat.co.uk>
+
+(fixes wrt can/AUTOLOAD sponsored by L<http://reask.com/>)
+
+=head1 LICENSE
+
+Copyright (c) 2007-2010 the aforementioned authors. All rights
+reserved. This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+=cut

Deleted: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class.pm
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class.pm	2011-06-08 22:35:52 UTC (rev 14039)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class.pm	2011-06-17 16:12:39 UTC (rev 14045)
@@ -1,494 +0,0 @@
-package Catalyst::Authentication::Store::DBIx::Class;
-
-use strict;
-use warnings;
-use base qw/Class::Accessor::Fast/;
-
-our $VERSION= "0.1500";
-
-
-BEGIN {
-    __PACKAGE__->mk_accessors(qw/config/);
-}
-
-
-sub new {
-    my ( $class, $config, $app ) = @_;
-
-    ## figure out if we are overriding the default store user class
-    $config->{'store_user_class'} = (exists($config->{'store_user_class'})) ? $config->{'store_user_class'} :
-                                        "Catalyst::Authentication::Store::DBIx::Class::User";
-
-    ## make sure the store class is loaded.
-    Catalyst::Utils::ensure_class_loaded( $config->{'store_user_class'} );
-
-    ## fields can be specified to be ignored during user location.  This allows
-    ## the store to ignore certain fields in the authinfo hash.
-
-    $config->{'ignore_fields_in_find'} ||= [ ];
-
-    my $self = {
-                    config => $config
-               };
-
-    bless $self, $class;
-
-}
-
-## --jk note to self:
-## let's use DBIC's get_columns method to return a hash and save / restore that
-## from the session.  Then we can respond to get() calls, etc. in most cases without
-## resorting to a DB call.  If user_object is called, THEN we can hit the DB and
-## return a real object.
-sub from_session {
-    my ( $self, $c, $frozenuser ) = @_;
-
-#    return $frozenuser if ref $frozenuser;
-
-    my $user = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
-    return $user->from_session($frozenuser, $c);
-}
-
-sub for_session {
-    my ($self, $c, $user) = @_;
-
-    return $user->for_session($c);
-}
-
-sub find_user {
-    my ( $self, $authinfo, $c ) = @_;
-
-    my $user = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
-
-    return $user->load($authinfo, $c);
-
-}
-
-sub user_supports {
-    my $self = shift;
-    # this can work as a class method on the user class
-    $self->config->{'store_user_class'}->supports( @_ );
-}
-
-sub auto_create_user {
-    my( $self, $authinfo, $c ) = @_;
-    my $res = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
-    return $res->auto_create( $authinfo, $c );
-}
-
-sub auto_update_user {
-    my( $self, $authinfo, $c, $res ) = @_;
-    $res->auto_update( $authinfo, $c );
-    return $res;
-}
-
-__PACKAGE__;
-
-__END__
-
-=head1 NAME
-
-Catalyst::Authentication::Store::DBIx::Class - A storage class for Catalyst Authentication using DBIx::Class
-
-=head1 VERSION
-
-This documentation refers to version 0.1500.
-
-=head1 SYNOPSIS
-
-    use Catalyst qw/
-                    Authentication
-                    Authorization::Roles/;
-
-    __PACKAGE__->config->{authentication} =
-                    {
-                        default_realm => 'members',
-                        realms => {
-                            members => {
-                                credential => {
-                                    class => 'Password',
-                                    password_field => 'password',
-                                    password_type => 'clear'
-                                },
-                                store => {
-                                    class => 'DBIx::Class',
-            	                    user_model => 'MyApp::User',
-            	                    role_relation => 'roles',
-            	                    role_field => 'rolename',
-            	                }
-                            }
-                    	}
-                    };
-
-    # Log a user in:
-
-    sub login : Global {
-        my ( $self, $c ) = @_;
-
-        $c->authenticate({
-                          screen_name => $c->req->params->{username},
-                          password => $c->req->params->{password},
-                          status => [ 'registered', 'loggedin', 'active']
-                          }))
-    }
-
-    # verify a role
-
-    if ( $c->check_user_roles( 'editor' ) ) {
-        # do editor stuff
-    }
-
-=head1 DESCRIPTION
-
-The Catalyst::Authentication::Store::DBIx::Class class provides
-access to authentication information stored in a database via DBIx::Class.
-
-=head1 CONFIGURATION
-
-The DBIx::Class authentication store is activated by setting the store
-config's B<class> element to DBIx::Class as shown above. See the
-L<Catalyst::Plugin::Authentication> documentation for more details on
-configuring the store. You can also use
-L<Catalyst::Authentication::Realm::SimpleDB> for a simplified setup.
-
-The DBIx::Class storage module has several configuration options
-
-
-    __PACKAGE__->config->{authentication} =
-                    {
-                        default_realm => 'members',
-                        realms => {
-                            members => {
-                                credential => {
-                                    # ...
-                                },
-                                store => {
-                                    class => 'DBIx::Class',
-            	                    user_model => 'MyApp::User',
-            	                    role_relation => 'roles',
-            	                    role_field => 'rolename',
-            	                    ignore_fields_in_find => [ 'remote_name' ],
-            	                    use_userdata_from_session => 1,
-            	                }
-                	        }
-                    	}
-                    };
-
-=over 4
-
-=item class
-
-Class is part of the core Catalyst::Plugin::Authentication module; it
-contains the class name of the store to be used.
-
-=item user_model
-
-Contains the model name (as passed to $c->model()) of the DBIx::Class schema
-to use as the source for user information. This config item is B<REQUIRED>.
-
-(Note that this option used to be called C<< user_class >>. C<< user_class >> is
-still functional, but should be used only for compatibility with previous configs.
-The setting called C<< user_class >> on other authentication stores is
-present, but named C<< store_user_class >> in this store)
-
-=item role_column
-
-If your role information is stored in the same table as the rest of your user
-information, this item tells the module which field contains your role
-information.  The DBIx::Class authentication store expects the data in this
-field to be a series of role names separated by some combination of spaces,
-commas, or pipe characters.
-
-=item role_relation
-
-If your role information is stored in a separate table, this is the name of
-the relation that will lead to the roles the user is in.  If this is
-specified, then a role_field is also required.  Also when using this method
-it is expected that your role table will return one row for each role
-the user is in.
-
-=item role_field
-
-This is the name of the field in the role table that contains the string
-identifying the role.
-
-=item ignore_fields_in_find
-
-This item is an array containing fields that may be passed to the
-$c->authenticate() routine (and therefore find_user in the storage class), but
-which should be ignored when creating the DBIx::Class search to retrieve a
-user. This makes it possible to avoid problems when a credential requires an
-authinfo element whose name overlaps with a column name in your users table.
-If this doesn't make sense to you, you probably don't need it.
-
-=item use_userdata_from_session
-
-Under normal circumstances, on each request the user's data is re-retrieved
-from the database using the primary key for the user table.  When this flag
-is set in the configuration, it causes the DBIx::Class store to avoid this
-database hit on session restore.  Instead, the user object's column data
-is retrieved from the session and used as-is.
-
-B<NOTE>: Since the user object's column
-data is only stored in the session during the initial authentication of
-the user, turning this on can potentially lead to a situation where the data
-in $c->user is different from what is stored the database.  You can force
-a reload of the data from the database at any time by calling $c->user->get_object(1);
-Note that this will update $c->user for the remainder of this request.
-It will NOT update the session.  If you need to update the session
-you should call $c->update_user_in_session() as well.
-
-=item store_user_class
-
-This allows you to override the authentication user class that the
-DBIx::Class store module uses to perform its work.  Most of the
-work done in this module is actually done by the user class,
-L<Catalyst::Authentication::Store::DBIx::Class::User>, so
-overriding this doesn't make much sense unless you are using your
-own class to extend the functionality of the existing class.
-Chances are you do not want to set this.
-
-=item id_field
-
-In most cases, this config variable does not need to be set, as
-Catalyst::Authentication::Store::DBIx::Class will determine the primary
-key of the user table on its own.  If you need to override the default,
-or your user table has multiple primary keys, then id_field
-should contain the column name that should be used to restore the user.
-A given value in this column should correspond to a single user in the database.
-Note that this is used B<ONLY> when restoring a user from the session and
-has no bearing whatsoever in the initial authentication process.  Note also
-that if use_userdata_from_session is enabled, this config parameter
-is not used at all.
-
-=back
-
-=head1 USAGE
-
-The L<Catalyst::Authentication::Store::DBIx::Class> storage module
-is not called directly from application code.  You interface with it
-through the $c->authenticate() call.
-
-There are three methods you can use to retrieve information from the DBIx::Class
-storage module.  They are Simple retrieval, and the advanced retrieval methods
-Searchargs and Resultset.
-
-=head2 Simple Retrieval
-
-The first, and most common, method is simple retrieval. As its name implies
-simple retrieval allows you to simply to provide the column => value pairs
-that should be used to locate the user in question. An example of this usage
-is below:
-
-    if ($c->authenticate({
-                          screen_name => $c->req->params->{'username'},
-                          password => $c->req->params->{'password'},
-                          status => [ 'registered', 'active', 'loggedin']
-                         })) {
-
-        # ... authenticated user code here
-    }
-
-The above example would attempt to retrieve a user whose username column (here,
-screen_name) matched the username provided, and whose status column matched one of the
-values provided. These name => value pairs are used more or less directly in
-the DBIx::Class search() routine, so in most cases, you can use DBIx::Class
-syntax to retrieve the user according to whatever rules you have.
-
-NOTE: Because the password in most cases is encrypted - it is not used
-directly but its encryption and comparison with the value provided is usually
-handled by the Password Credential. Part of the Password Credential's behavior
-is to remove the password argument from the authinfo that is passed to the
-storage module. See L<Catalyst::Authentication::Credential::Password>.
-
-One thing you need to know about this retrieval method is that the name
-portion of the pair is checked against the user class's column list. Pairs are
-only used if a matching column is found. Other pairs will be ignored. This
-means that you can only provide simple name-value pairs, and that some more
-advanced DBIx::Class constructs, such as '-or', '-and', etc. are in most cases
-not possible using this method. For queries that require this level of
-functionality, see the 'searchargs' method below.
-
-=head2 Advanced Retrieval
-
-The Searchargs and Resultset retrieval methods are used when more advanced
-features of the underlying L<DBIx::Class> schema are required. These methods
-provide a direct interface with the DBIx::Class schema and therefore
-require a better understanding of the DBIx::Class module.
-
-=head3 The dbix_class key
-
-Since the format of these arguments are often complex, they are not keys in
-the base authinfo hash.  Instead, both of these arguments are placed within
-a hash attached to the store-specific 'dbix_class' key in the base $authinfo
-hash.  When the DBIx::Class authentication store sees the 'dbix_class' key
-in the passed authinfo hash, all the other information in the authinfo hash
-is ignored and only the values within the 'dbix_class' hash are used as
-though they were passed directly within the authinfo hash.  In other words, if
-'dbix_class' is present, it replaces the authinfo hash for processing purposes.
-
-The 'dbix_class' hash can be used to directly pass arguments to the
-DBIx::Class authentication store. Reasons to do this are to avoid credential
-modification of the authinfo hash, or to avoid overlap between credential and
-store key names. It's a good idea to avoid using it in this way unless you are
-sure you have an overlap/modification issue. However, the two advanced
-retrieval methods, B<searchargs>, B<result> and B<resultset>, require its use,
-as they are only processed as part of the 'dbix_class' hash.
-
-=over 4
-
-=item Searchargs
-
-The B<searchargs> method of retrieval allows you to specify an arrayref containing
-the two arguments to the search() method from L<DBIx::Class::ResultSet>.  If provided,
-all other args are ignored, and the search args provided are used directly to locate
-the user.  An example will probably make more sense:
-
-    if ($c->authenticate(
-        {
-            password => $password,
-            'dbix_class' =>
-                {
-                    searchargs => [ { -or => [ username => $username,
-                                              email => $email,
-                                              clientid => $clientid ]
-                                   },
-                                   { prefetch => qw/ preferences / }
-                                 ]
-                }
-        } ) )
-    {
-        # do successful authentication actions here.
-    }
-
-The above would allow authentication based on any of the three items -
-username, email, or clientid - and would prefetch the data related to that user
-from the preferences table. The searchargs array is passed directly to the
-search() method associated with the user_model.
-
-=item Result
-
-The B<result> method of retrieval allows you to look up the user yourself and
-pass on the loaded user to the authentication store.
-
-    my $user = $ctx->model('MyApp::User')->find({ ... });
-
-    if ($ctx->authenticate({ dbix_class => { result => $user } })) {
-        ...
-    }
-
-Be aware that the result method will not verify that you are passing a result
-that is attached to the same user_model as specified in the config or even
-loaded from the database, as opposed to existing only in memory. It's your
-responsibility to make sure of that.
-
-=item Resultset
-
-The B<resultset> method of retrieval allows you to directly specify a
-resultset to be used for user retrieval. This allows you to create a resultset
-within your login action and use it for retrieving the user. A simple example:
-
-    my $rs = $c->model('MyApp::User')->search({ email => $c->request->params->{'email'} });
-       ... # further $rs adjustments
-
-    if ($c->authenticate({
-                           password => $password,
-                           'dbix_class' => { resultset => $rs }
-                         })) {
-       # do successful authentication actions here.
-    }
-
-Be aware that the resultset method will not verify that you are passing a
-resultset that is attached to the same user_model as specified in the config.
-
-NOTE: The resultset and searchargs methods of user retrieval, consider the first
-row returned to be the matching user. In most cases there will be only one
-matching row, but it is easy to produce multiple rows, especially when using the
-advanced retrieval methods. Remember, what you get when you use this module is
-what you would get when calling search(...)->first;
-
-NOTE ALSO:  The user info used to save the user to the session and to retrieve
-it is the same regardless of what method of retrieval was used.  In short,
-the value in the id field (see 'id_field' config item) is used to retrieve the
-user from the database upon restoring from the session.  When the DBIx::Class storage
-module does this, it does so by doing a simple search using the id field.  In other
-words, it will not use the same arguments you used to request the user initially.
-This is especially important to those using the advanced methods of user retrieval.
-If you need more complicated logic when reviving the user from the session, you will
-most likely want to subclass the L<Catalyst::Authentication::Store::DBIx::Class::User> class
-and provide your own for_session and from_session routines.
-
-=back
-
-
-=head1 METHODS
-
-There are no publicly exported routines in the DBIx::Class authentication
-store (or indeed in most authentication stores). However, below is a
-description of the routines required by L<Catalyst::Plugin::Authentication>
-for all authentication stores.  Please see the documentation for
-L<Catalyst::Plugin::Authentication::Internals> for more information.
-
-
-=head2 new ( $config, $app )
-
-Constructs a new store object.
-
-=head2 find_user ( $authinfo, $c )
-
-Finds a user using the information provided in the $authinfo hashref and
-returns the user, or undef on failure. This is usually called from the
-Credential. This translates directly to a call to
-L<Catalyst::Authentication::Store::DBIx::Class::User>'s load() method.
-
-=head2 for_session ( $c, $user )
-
-Prepares a user to be stored in the session. Currently returns the value of
-the user's id field (as indicated by the 'id_field' config element)
-
-=head2 from_session ( $c, $frozenuser)
-
-Revives a user from the session based on the info provided in $frozenuser.
-Currently treats $frozenuser as an id and retrieves a user with a matching id.
-
-=head2 user_supports
-
-Provides information about what the user object supports.
-
-=head2 auto_update_user( $authinfo, $c, $res )
-
-This method is called if the realm's auto_update_user setting is true. It
-will delegate to the user object's C<auto_update> method.
-
-=head2 auto_create_user( $authinfo, $c )
-
-This method is called if the realm's auto_create_user setting is true. It
-will delegate to the user class's (resultset) C<auto_create> method.
-
-=head1 NOTES
-
-As of the current release, session storage consists of simply storing the user's
-id in the session, and then using that same id to re-retrieve the user's information
-from the database upon restoration from the session.  More dynamic storage of
-user information in the session is intended for a future release.
-
-=head1 BUGS AND LIMITATIONS
-
-None known currently; please email the author if you find any.
-
-=head1 SEE ALSO
-
-L<Catalyst::Plugin::Authentication>, L<Catalyst::Plugin::Authentication::Internals>,
-and L<Catalyst::Plugin::Authorization::Roles>
-
-=head1 AUTHOR
-
-Jason Kuri (jayk at cpan.org)
-
-=head1 LICENSE
-
-Copyright (c) 2007 the aforementioned authors. All rights
-reserved. This program is free software; you can redistribute
-it and/or modify it under the same terms as Perl itself.
-
-=cut

Copied: Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class.pm (from rev 14044, Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class.pm)
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class.pm	                        (rev 0)
+++ Catalyst-Authentication-Store-DBIx-Class/tags/0.1501/lib/Catalyst/Authentication/Store/DBIx/Class.pm	2011-06-17 16:12:39 UTC (rev 14045)
@@ -0,0 +1,494 @@
+package Catalyst::Authentication::Store::DBIx::Class;
+
+use strict;
+use warnings;
+use base qw/Class::Accessor::Fast/;
+
+our $VERSION= "0.1501";
+
+
+BEGIN {
+    __PACKAGE__->mk_accessors(qw/config/);
+}
+
+
+sub new {
+    my ( $class, $config, $app ) = @_;
+
+    ## figure out if we are overriding the default store user class
+    $config->{'store_user_class'} = (exists($config->{'store_user_class'})) ? $config->{'store_user_class'} :
+                                        "Catalyst::Authentication::Store::DBIx::Class::User";
+
+    ## make sure the store class is loaded.
+    Catalyst::Utils::ensure_class_loaded( $config->{'store_user_class'} );
+
+    ## fields can be specified to be ignored during user location.  This allows
+    ## the store to ignore certain fields in the authinfo hash.
+
+    $config->{'ignore_fields_in_find'} ||= [ ];
+
+    my $self = {
+                    config => $config
+               };
+
+    bless $self, $class;
+
+}
+
+## --jk note to self:
+## let's use DBIC's get_columns method to return a hash and save / restore that
+## from the session.  Then we can respond to get() calls, etc. in most cases without
+## resorting to a DB call.  If user_object is called, THEN we can hit the DB and
+## return a real object.
+sub from_session {
+    my ( $self, $c, $frozenuser ) = @_;
+
+#    return $frozenuser if ref $frozenuser;
+
+    my $user = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
+    return $user->from_session($frozenuser, $c);
+}
+
+sub for_session {
+    my ($self, $c, $user) = @_;
+
+    return $user->for_session($c);
+}
+
+sub find_user {
+    my ( $self, $authinfo, $c ) = @_;
+
+    my $user = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
+
+    return $user->load($authinfo, $c);
+
+}
+
+sub user_supports {
+    my $self = shift;
+    # this can work as a class method on the user class
+    $self->config->{'store_user_class'}->supports( @_ );
+}
+
+sub auto_create_user {
+    my( $self, $authinfo, $c ) = @_;
+    my $res = $self->config->{'store_user_class'}->new($self->{'config'}, $c);
+    return $res->auto_create( $authinfo, $c );
+}
+
+sub auto_update_user {
+    my( $self, $authinfo, $c, $res ) = @_;
+    $res->auto_update( $authinfo, $c );
+    return $res;
+}
+
+__PACKAGE__;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Authentication::Store::DBIx::Class - A storage class for Catalyst Authentication using DBIx::Class
+
+=head1 VERSION
+
+This documentation refers to version 0.1501.
+
+=head1 SYNOPSIS
+
+    use Catalyst qw/
+                    Authentication
+                    Authorization::Roles/;
+
+    __PACKAGE__->config->{authentication} =
+                    {
+                        default_realm => 'members',
+                        realms => {
+                            members => {
+                                credential => {
+                                    class => 'Password',
+                                    password_field => 'password',
+                                    password_type => 'clear'
+                                },
+                                store => {
+                                    class => 'DBIx::Class',
+            	                    user_model => 'MyApp::User',
+            	                    role_relation => 'roles',
+            	                    role_field => 'rolename',
+            	                }
+                            }
+                    	}
+                    };
+
+    # Log a user in:
+
+    sub login : Global {
+        my ( $self, $c ) = @_;
+
+        $c->authenticate({
+                          screen_name => $c->req->params->{username},
+                          password => $c->req->params->{password},
+                          status => [ 'registered', 'loggedin', 'active']
+                          }))
+    }
+
+    # verify a role
+
+    if ( $c->check_user_roles( 'editor' ) ) {
+        # do editor stuff
+    }
+
+=head1 DESCRIPTION
+
+The Catalyst::Authentication::Store::DBIx::Class class provides
+access to authentication information stored in a database via DBIx::Class.
+
+=head1 CONFIGURATION
+
+The DBIx::Class authentication store is activated by setting the store
+config's B<class> element to DBIx::Class as shown above. See the
+L<Catalyst::Plugin::Authentication> documentation for more details on
+configuring the store. You can also use
+L<Catalyst::Authentication::Realm::SimpleDB> for a simplified setup.
+
+The DBIx::Class storage module has several configuration options
+
+
+    __PACKAGE__->config->{authentication} =
+                    {
+                        default_realm => 'members',
+                        realms => {
+                            members => {
+                                credential => {
+                                    # ...
+                                },
+                                store => {
+                                    class => 'DBIx::Class',
+            	                    user_model => 'MyApp::User',
+            	                    role_relation => 'roles',
+            	                    role_field => 'rolename',
+            	                    ignore_fields_in_find => [ 'remote_name' ],
+            	                    use_userdata_from_session => 1,
+            	                }
+                	        }
+                    	}
+                    };
+
+=over 4
+
+=item class
+
+Class is part of the core Catalyst::Plugin::Authentication module; it
+contains the class name of the store to be used.
+
+=item user_model
+
+Contains the model name (as passed to $c->model()) of the DBIx::Class schema
+to use as the source for user information. This config item is B<REQUIRED>.
+
+(Note that this option used to be called C<< user_class >>. C<< user_class >> is
+still functional, but should be used only for compatibility with previous configs.
+The setting called C<< user_class >> on other authentication stores is
+present, but named C<< store_user_class >> in this store)
+
+=item role_column
+
+If your role information is stored in the same table as the rest of your user
+information, this item tells the module which field contains your role
+information.  The DBIx::Class authentication store expects the data in this
+field to be a series of role names separated by some combination of spaces,
+commas, or pipe characters.
+
+=item role_relation
+
+If your role information is stored in a separate table, this is the name of
+the relation that will lead to the roles the user is in.  If this is
+specified, then a role_field is also required.  Also when using this method
+it is expected that your role table will return one row for each role
+the user is in.
+
+=item role_field
+
+This is the name of the field in the role table that contains the string
+identifying the role.
+
+=item ignore_fields_in_find
+
+This item is an array containing fields that may be passed to the
+$c->authenticate() routine (and therefore find_user in the storage class), but
+which should be ignored when creating the DBIx::Class search to retrieve a
+user. This makes it possible to avoid problems when a credential requires an
+authinfo element whose name overlaps with a column name in your users table.
+If this doesn't make sense to you, you probably don't need it.
+
+=item use_userdata_from_session
+
+Under normal circumstances, on each request the user's data is re-retrieved
+from the database using the primary key for the user table.  When this flag
+is set in the configuration, it causes the DBIx::Class store to avoid this
+database hit on session restore.  Instead, the user object's column data
+is retrieved from the session and used as-is.
+
+B<NOTE>: Since the user object's column
+data is only stored in the session during the initial authentication of
+the user, turning this on can potentially lead to a situation where the data
+in $c->user is different from what is stored the database.  You can force
+a reload of the data from the database at any time by calling $c->user->get_object(1);
+Note that this will update $c->user for the remainder of this request.
+It will NOT update the session.  If you need to update the session
+you should call $c->update_user_in_session() as well.
+
+=item store_user_class
+
+This allows you to override the authentication user class that the
+DBIx::Class store module uses to perform its work.  Most of the
+work done in this module is actually done by the user class,
+L<Catalyst::Authentication::Store::DBIx::Class::User>, so
+overriding this doesn't make much sense unless you are using your
+own class to extend the functionality of the existing class.
+Chances are you do not want to set this.
+
+=item id_field
+
+In most cases, this config variable does not need to be set, as
+Catalyst::Authentication::Store::DBIx::Class will determine the primary
+key of the user table on its own.  If you need to override the default,
+or your user table has multiple primary keys, then id_field
+should contain the column name that should be used to restore the user.
+A given value in this column should correspond to a single user in the database.
+Note that this is used B<ONLY> when restoring a user from the session and
+has no bearing whatsoever in the initial authentication process.  Note also
+that if use_userdata_from_session is enabled, this config parameter
+is not used at all.
+
+=back
+
+=head1 USAGE
+
+The L<Catalyst::Authentication::Store::DBIx::Class> storage module
+is not called directly from application code.  You interface with it
+through the $c->authenticate() call.
+
+There are three methods you can use to retrieve information from the DBIx::Class
+storage module.  They are Simple retrieval, and the advanced retrieval methods
+Searchargs and Resultset.
+
+=head2 Simple Retrieval
+
+The first, and most common, method is simple retrieval. As its name implies
+simple retrieval allows you to simply to provide the column => value pairs
+that should be used to locate the user in question. An example of this usage
+is below:
+
+    if ($c->authenticate({
+                          screen_name => $c->req->params->{'username'},
+                          password => $c->req->params->{'password'},
+                          status => [ 'registered', 'active', 'loggedin']
+                         })) {
+
+        # ... authenticated user code here
+    }
+
+The above example would attempt to retrieve a user whose username column (here,
+screen_name) matched the username provided, and whose status column matched one of the
+values provided. These name => value pairs are used more or less directly in
+the DBIx::Class search() routine, so in most cases, you can use DBIx::Class
+syntax to retrieve the user according to whatever rules you have.
+
+NOTE: Because the password in most cases is encrypted - it is not used
+directly but its encryption and comparison with the value provided is usually
+handled by the Password Credential. Part of the Password Credential's behavior
+is to remove the password argument from the authinfo that is passed to the
+storage module. See L<Catalyst::Authentication::Credential::Password>.
+
+One thing you need to know about this retrieval method is that the name
+portion of the pair is checked against the user class's column list. Pairs are
+only used if a matching column is found. Other pairs will be ignored. This
+means that you can only provide simple name-value pairs, and that some more
+advanced DBIx::Class constructs, such as '-or', '-and', etc. are in most cases
+not possible using this method. For queries that require this level of
+functionality, see the 'searchargs' method below.
+
+=head2 Advanced Retrieval
+
+The Searchargs and Resultset retrieval methods are used when more advanced
+features of the underlying L<DBIx::Class> schema are required. These methods
+provide a direct interface with the DBIx::Class schema and therefore
+require a better understanding of the DBIx::Class module.
+
+=head3 The dbix_class key
+
+Since the format of these arguments are often complex, they are not keys in
+the base authinfo hash.  Instead, both of these arguments are placed within
+a hash attached to the store-specific 'dbix_class' key in the base $authinfo
+hash.  When the DBIx::Class authentication store sees the 'dbix_class' key
+in the passed authinfo hash, all the other information in the authinfo hash
+is ignored and only the values within the 'dbix_class' hash are used as
+though they were passed directly within the authinfo hash.  In other words, if
+'dbix_class' is present, it replaces the authinfo hash for processing purposes.
+
+The 'dbix_class' hash can be used to directly pass arguments to the
+DBIx::Class authentication store. Reasons to do this are to avoid credential
+modification of the authinfo hash, or to avoid overlap between credential and
+store key names. It's a good idea to avoid using it in this way unless you are
+sure you have an overlap/modification issue. However, the two advanced
+retrieval methods, B<searchargs>, B<result> and B<resultset>, require its use,
+as they are only processed as part of the 'dbix_class' hash.
+
+=over 4
+
+=item Searchargs
+
+The B<searchargs> method of retrieval allows you to specify an arrayref containing
+the two arguments to the search() method from L<DBIx::Class::ResultSet>.  If provided,
+all other args are ignored, and the search args provided are used directly to locate
+the user.  An example will probably make more sense:
+
+    if ($c->authenticate(
+        {
+            password => $password,
+            'dbix_class' =>
+                {
+                    searchargs => [ { -or => [ username => $username,
+                                              email => $email,
+                                              clientid => $clientid ]
+                                   },
+                                   { prefetch => qw/ preferences / }
+                                 ]
+                }
+        } ) )
+    {
+        # do successful authentication actions here.
+    }
+
+The above would allow authentication based on any of the three items -
+username, email, or clientid - and would prefetch the data related to that user
+from the preferences table. The searchargs array is passed directly to the
+search() method associated with the user_model.
+
+=item Result
+
+The B<result> method of retrieval allows you to look up the user yourself and
+pass on the loaded user to the authentication store.
+
+    my $user = $ctx->model('MyApp::User')->find({ ... });
+
+    if ($ctx->authenticate({ dbix_class => { result => $user } })) {
+        ...
+    }
+
+Be aware that the result method will not verify that you are passing a result
+that is attached to the same user_model as specified in the config or even
+loaded from the database, as opposed to existing only in memory. It's your
+responsibility to make sure of that.
+
+=item Resultset
+
+The B<resultset> method of retrieval allows you to directly specify a
+resultset to be used for user retrieval. This allows you to create a resultset
+within your login action and use it for retrieving the user. A simple example:
+
+    my $rs = $c->model('MyApp::User')->search({ email => $c->request->params->{'email'} });
+       ... # further $rs adjustments
+
+    if ($c->authenticate({
+                           password => $password,
+                           'dbix_class' => { resultset => $rs }
+                         })) {
+       # do successful authentication actions here.
+    }
+
+Be aware that the resultset method will not verify that you are passing a
+resultset that is attached to the same user_model as specified in the config.
+
+NOTE: The resultset and searchargs methods of user retrieval, consider the first
+row returned to be the matching user. In most cases there will be only one
+matching row, but it is easy to produce multiple rows, especially when using the
+advanced retrieval methods. Remember, what you get when you use this module is
+what you would get when calling search(...)->first;
+
+NOTE ALSO:  The user info used to save the user to the session and to retrieve
+it is the same regardless of what method of retrieval was used.  In short,
+the value in the id field (see 'id_field' config item) is used to retrieve the
+user from the database upon restoring from the session.  When the DBIx::Class storage
+module does this, it does so by doing a simple search using the id field.  In other
+words, it will not use the same arguments you used to request the user initially.
+This is especially important to those using the advanced methods of user retrieval.
+If you need more complicated logic when reviving the user from the session, you will
+most likely want to subclass the L<Catalyst::Authentication::Store::DBIx::Class::User> class
+and provide your own for_session and from_session routines.
+
+=back
+
+
+=head1 METHODS
+
+There are no publicly exported routines in the DBIx::Class authentication
+store (or indeed in most authentication stores). However, below is a
+description of the routines required by L<Catalyst::Plugin::Authentication>
+for all authentication stores.  Please see the documentation for
+L<Catalyst::Plugin::Authentication::Internals> for more information.
+
+
+=head2 new ( $config, $app )
+
+Constructs a new store object.
+
+=head2 find_user ( $authinfo, $c )
+
+Finds a user using the information provided in the $authinfo hashref and
+returns the user, or undef on failure. This is usually called from the
+Credential. This translates directly to a call to
+L<Catalyst::Authentication::Store::DBIx::Class::User>'s load() method.
+
+=head2 for_session ( $c, $user )
+
+Prepares a user to be stored in the session. Currently returns the value of
+the user's id field (as indicated by the 'id_field' config element)
+
+=head2 from_session ( $c, $frozenuser)
+
+Revives a user from the session based on the info provided in $frozenuser.
+Currently treats $frozenuser as an id and retrieves a user with a matching id.
+
+=head2 user_supports
+
+Provides information about what the user object supports.
+
+=head2 auto_update_user( $authinfo, $c, $res )
+
+This method is called if the realm's auto_update_user setting is true. It
+will delegate to the user object's C<auto_update> method.
+
+=head2 auto_create_user( $authinfo, $c )
+
+This method is called if the realm's auto_create_user setting is true. It
+will delegate to the user class's (resultset) C<auto_create> method.
+
+=head1 NOTES
+
+As of the current release, session storage consists of simply storing the user's
+id in the session, and then using that same id to re-retrieve the user's information
+from the database upon restoration from the session.  More dynamic storage of
+user information in the session is intended for a future release.
+
+=head1 BUGS AND LIMITATIONS
+
+None known currently; please email the author if you find any.
+
+=head1 SEE ALSO
+
+L<Catalyst::Plugin::Authentication>, L<Catalyst::Plugin::Authentication::Internals>,
+and L<Catalyst::Plugin::Authorization::Roles>
+
+=head1 AUTHOR
+
+Jason Kuri (jayk at cpan.org)
+
+=head1 LICENSE
+
+Copyright (c) 2007 the aforementioned authors. All rights
+reserved. This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+=cut




More information about the Catalyst-commits mailing list