NAME
Mango::Provider::Users - Provider class for user information
SYNOPSIS
my $provider = Mango::Provider::Users->new;
my $user = $provider->get_by_id(23);
DESCRIPTION
Mango::Provider::Users is the provider class responsible for creating, deleting, updating and searching users.
CONSTRUCTOR
new
Creates a new user provider object. If options are passed to new, those are sent to setup
.
my $provider = Mango::Provider::Users->new;
See "new" in Mango::Provider and "new" in Mango::Provider::DBIC for a list of other possible options.
METHODS
create
Creates a new Mango::User object using the supplied data.
my $user = $provider->create({
username => 'admin',
password => 'r2d2c3po'
});
print $user->username;
delete
Deletes users from the provider matching the supplied filter.
$provider->delete({
username => 'claco'
});
get_by_id
Returns a Mango::User object matching the specified id.
my $user = $provider->get_by_id(23);
Returns undef if no matching user can be found.
search
Returns a list of Mango::User objects in list context, or a Mango::Iterator in scalar context matching the specified filter.
my @users = $provider->search({
username => 'C%'
});
my $iterator = $provider->search({
username => 'C%'
});
See "ATTRIBUTES" in DBIx::Class::Resultset for a list of other possible options.
update
Sets the 'updated' column to DateTime->now and saves any changes made to the user back to the underlying store.
my $user = $provider->create(\%data);
$user->password('newpwd');
$provider->update($user);
SEE ALSO
Mango::Provider, Mango::Provider::DBIC, Mango::Role, DBIx::Class
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/