MetaStore::Users - abstract class for collections of users.


MetaStore documentation Contained in the MetaStore distribution.

Index


Code Index:

NAME

Top

MetaStore::Users - abstract class for collections of users.

SYNOPSIS

Top

    use MetaStore::Users;

DESCRIPTION

Top

MetaStore::Users - abstract class for collections of users.

METHODS

Top

get_by_log_pass

get_by_log_pass

get_by_sess

get_by_sess

get_guest

get_guest

SEE ALSO

Top

MetaStore, README

AUTHOR

Top

Zahatski Aliaksandr, <zag@cpan.org>

COPYRIGHT AND LICENSE

Top


MetaStore documentation Contained in the MetaStore distribution.
package MetaStore::Users;

use strict;
use warnings;
use Collection::AutoSQL;
use Data::Dumper;
use MetaStore::Auth::User;
use MetaStore::Auth::UserGuest;

our @ISA     = qw(Collection::AutoSQL );
our $VERSION = '0.01';

sub _init {
    my $self = shift;
    my %args = @_;
    $args{sub_ref} = sub { $self->_create_obj(@_) };
    $self->SUPER::_init(%args);
}

sub _create_obj {
    my $self = shift;
    my ( $id, $refs ) = @_;
    return new MetaStore::Auth::User { id => $id, attr => $refs }, $refs;
}

sub get_by_log_pass {
    my $self = shift;
    my %args = @_;
    my ( $login, $passwd ) = @args{qw/ lg pw /};
    $self->fetch_one( { login => $login, password => $passwd } );
}

sub get_by_sess {
    my $self = shift;
    my $sess_id = shift || return undef;
    $self->fetch_one( { sess_id => $sess_id } );
}

sub get_guest {
    my $self = shift;
    return new MetaStore::Auth::UserGuest::;
}

1;
__END__