[Catalyst-commits] r10171 - in
Catalyst-Authentication-Store-LDAP/trunk: .
lib/Catalyst/Authentication/Store/LDAP
gphat at dev.catalyst.perl.org
gphat at dev.catalyst.perl.org
Fri May 15 20:25:36 GMT 2009
Author: gphat
Date: 2009-05-15 20:25:36 +0000 (Fri, 15 May 2009)
New Revision: 10171
Modified:
Catalyst-Authentication-Store-LDAP/trunk/Changes
Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm
Log:
Pass $c along to find_user method so overridden user_class users can get at models (or whatever crazy things they might do)
Modified: Catalyst-Authentication-Store-LDAP/trunk/Changes
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/Changes 2009-05-15 15:47:33 UTC (rev 10170)
+++ Catalyst-Authentication-Store-LDAP/trunk/Changes 2009-05-15 20:25:36 UTC (rev 10171)
@@ -1,3 +1,7 @@
+0.1006
+ - Pass $c along to find_user method so overridden user_class users can
+ get at models (or whatever crazy things they might do) (gphat)
+
0.1005 30 April 2009
- Stop throwing an exception when the lookup_user method fails
to find a user and instead return undef. (t0m)
Modified: Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm 2009-05-15 15:47:33 UTC (rev 10170)
+++ Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm 2009-05-15 20:25:36 UTC (rev 10171)
@@ -129,7 +129,7 @@
return $self;
}
-=head2 find_user( I<authinfo> )
+=head2 find_user( I<authinfo>, $c )
Creates a L<Catalyst::Authentication::Store::LDAP::User> object
for the given User ID. This is the preferred mechanism for getting a
@@ -142,21 +142,23 @@
sub find_user {
my ( $self, $authinfo, $c ) = @_;
- return $self->get_user( $authinfo->{id} || $authinfo->{username} );
+ return $self->get_user( $authinfo->{id} || $authinfo->{username}, $c );
}
=head2 get_user($id)
Creates a L<Catalyst::Authentication::Store::LDAP::User> object
-for the given User ID. This is the preferred mechanism for getting a
-given User out of the Store.
+for the given User ID, or calls C<new> on the class specified in
+C<user_class>. This instance of the store object, the results of
+C<lookup_user> and $c are passed as arguments (in that order) to C<new>.
+This is the preferred mechanism for getting a given User out of the Store.
=cut
sub get_user {
- my ( $self, $id ) = @_;
+ my ( $self, $id, $c ) = @_;
my $user = $self->user_class->new( $self,
- $self->lookup_user($id) );
+ $self->lookup_user($id), $c );
return $user;
}
Modified: Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm 2009-05-15 15:47:33 UTC (rev 10170)
+++ Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm 2009-05-15 20:25:36 UTC (rev 10171)
@@ -57,18 +57,20 @@
=head1 METHODS
-=head2 new($store, $user)
+=head2 new($store, $user, $c)
Takes a L<Catalyst::Authentication::Store::LDAP::Backend> object
as $store, and the data structure returned by that class's "get_user"
-method as $user.
+method as $user. The final argument is an instance of your application,
+which is passed along for those wanting to subclass User and perhaps use
+models for fetching data.
Returns a L<Catalyst::Authentication::Store::LDAP::User> object.
=cut
sub new {
- my ( $class, $store, $user ) = @_;
+ my ( $class, $store, $user, $c ) = @_;
return unless $user;
More information about the Catalyst-commits
mailing list