X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAuthentication%2FStore%2FHtpasswd%2FUser.pm;h=d83c9c385ec0eb0cb544d785b3a193ed1c5f4b9a;hb=84f268d02180c5360a85530e3c06d15dca389775;hp=0f3e42b890d912038748f1d4aee703cb17436738;hpb=1658508350f43b56a125c3d276b7af0ad7d9b8e8;p=catagits%2FCatalyst-Authentication-Store-Htpasswd.git diff --git a/lib/Catalyst/Authentication/Store/Htpasswd/User.pm b/lib/Catalyst/Authentication/Store/Htpasswd/User.pm index 0f3e42b..d83c9c3 100644 --- a/lib/Catalyst/Authentication/Store/Htpasswd/User.pm +++ b/lib/Catalyst/Authentication/Store/Htpasswd/User.pm @@ -1,12 +1,16 @@ #!/usr/bin/perl package Catalyst::Authentication::Store::Htpasswd::User; +# ABSTRACT: A user object representing an entry in an htpasswd file. + use base qw/Catalyst::Authentication::User Class::Accessor::Fast/; use strict; use warnings; -BEGIN { __PACKAGE__->mk_accessors(qw/user store/) } +our $VERSION = '1.007'; + +BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) } use overload '""' => sub { shift->id }, fallback => 1; @@ -15,12 +19,12 @@ sub new { return unless $user; - bless { store => $store, user => $user }, $class; + bless { _store => $store, _user => $user }, $class; } sub id { my $self = shift; - return $self->user->username; + return $self->_user->username; } sub supported_features { @@ -35,28 +39,27 @@ sub supported_features { sub check_password { my ( $self, $password ) = @_; - return $self->user->check_password( $password ); + return $self->_user->check_password( $password ); } sub roles { my $self = shift; - my $field = $self->user->extra_info->[0]; + my $field = $self->_user->extra_info->[0]; return defined $field ? split /,/, $field : (); } -sub for_session { - my $self = shift; - return $self->id; -} +*for_session = \&id; + +*get_object = \&_user; sub AUTOLOAD { my $self = shift; - + ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ ); return if $method eq "DESTROY"; - - $self->user->$method; + + $self->_user->$method; } 1; @@ -65,15 +68,10 @@ __END__ =pod -=head1 NAME - -Catalyst::Authentication::Store::Htpasswd::User - A user object -representing an entry in an htpasswd file. - =head1 DESCRIPTION This object wraps an L object. An instance of it will be returned -by C<< $c->user >> when using L. Methods +by C<< $c->user >> when using L. Methods not defined in this module are passed through to the L object. The object stringifies to the username. @@ -81,8 +79,8 @@ object stringifies to the username. =head2 new($store,$user) -Creates a new object from a store object, normally an instance of -L, and a user object, +Creates a new object from a store object, normally an instance of +L, and a user object, normally an instance of L. =head2 id @@ -106,20 +104,8 @@ Returns the username, which is then stored in the session. Returns data about which featurs this user module supports. -=head1 AUTHORS - -Yuval Kogman C - -David Kamholz C - -Tomas Doran C +=head2 get_object -=head1 COPYRIGHT & LICENSE - - Copyright (c) 2005 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. +Returns the underlieing L object for this user =cut - -