| 1 | #!/usr/bin/perl | ||||||||||
| 2 | |||||||||||
| 3 | package Catalyst::Authentication::Store::Htpasswd::User; | ||||||||||
| 4 | # ABSTRACT: A user object representing an entry in an htpasswd file. | ||||||||||
| 5 | |||||||||||
| 6 | 4 | ▶ | use base qw/Catalyst::Authentication::User Class::Accessor::Fast/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 4 | our $VERSION = '1.006'; | |||||||||
| 12 | |||||||||||
| 13 | 4 | ▶ | BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 4 | ▶ | use overload '""' => sub { shift->id }, fallback => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 4 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 18 | 4 | my ( $class, $store, $user ) = @_; | |||||||||
| 19 | |||||||||||
| 20 | 4 | ▶ | return unless $user; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 4 | bless { _store => $store, _user => $user }, $class; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 4 | ▶ | sub id { | ||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 26 | 4 | my $self = shift; | |||||||||
| 27 | 4 | return $self->_user->username; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 4 | ▶ | sub supported_features { | ||||||||
|
Subroutine
supported_features: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 31 | return { | ||||||||||
| 32 | 4 | password => { | |||||||||
| 33 | self_check => 1, | ||||||||||
| 34 | }, | ||||||||||
| 35 | session => 1, | ||||||||||
| 36 | roles => 1, | ||||||||||
| 37 | }; | ||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 3 | ▶ | sub check_password { | ||||||||
|
Subroutine
check_password: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 41 | 3 | my ( $self, $password ) = @_; | |||||||||
| 42 | 3 | return $self->_user->check_password( $password ); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub roles { | ||||||||
|
Subroutine
roles: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 46 | 0 | my $self = shift; | |||||||||
| 47 | 0 | my $field = $self->_user->extra_info->[0]; | |||||||||
| 48 | 0 | ▶ | return defined $field ? split /,/, $field : (); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 4 | *for_session = \&id; | |||||||||
| 52 | |||||||||||
| 53 | 4 | *get_object = \&_user; | |||||||||
| 54 | |||||||||||
| 55 | 2 | ▶ | sub AUTOLOAD { | ||||||||
|
Subroutine
AUTOLOAD: called CC=2 SCAR=7.0
| |||||||||||
| 56 | 2 | my $self = shift; | |||||||||
| 57 | |||||||||||
| 58 | 2 | ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ ); | |||||||||
| 59 | |||||||||||
| 60 | 2 | ▶ | return if $method eq "DESTROY"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | |||||||||||
| 62 | 2 | $self->_user->$method; | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 4 | 1; | |||||||||
| 66 | |||||||||||
| 67 | __END__ | ||||||||||