Mango::Provider::Roles - Provider class for user role information
my $provider = Mango::Provider::Roles->new; my $role = $provider->get_by_id(23);
Mango::Provider::Roles is the provider class responsible for creating, deleting, updating and searching user role information.
Creates a new role provider object. If options are passed to new, those are sent to setup.
setup
my $provider = Mango::Provider::Roles->new;
See "new" in Mango::Provider and "new" in Mango::Provider::DBIC for a list of other possible options.
Adds the specified users to the specified role. users can be user objects or user ids and role can be a role object or a role id.
users
role
my $role = $provider->get_by_id(23); $provider->add_users($role, 23, $user);
Same as "add_user".
Creates a new Mango::Role object using the supplied data.
my $role = $provider->create({ name => 'Editors', description => 'Can edit content' }); print $role->name;
Deletes roles from the provider matching the supplied filter.
$provider->delete({ name => 'Editors' });
Returns a Mango::Role object matching the specified id.
my $role = $provider->get_by_id(23);
Returns undef if no matching role can be found.
Removes the specified users from the specified role. users can be user objects or user ids and role can be a role object or a role id.
my $role = $provider->get_by_id(23); $provider->remove_users($role, 23, $user);
Same as "remove_user".
Returns a list of Mango::Role objects in list context, or a Mango::Iterator in scalar context matching the specified filter.
my @roles = $provider->search({ name => 'A%' }); my $iterator = $provider->search({ name => 'A%' });
In addition to using the column names, the following special keys are available:
This can be a user id, or a user object for which roles are assigned to.
my @roles = $provider->search({ user => $user }); my $roles = $provider->search({ user => $user });
See "ATTRIBUTES" in DBIx::Class::Resultset for a list of other possible options.
Sets the 'updated' column to DateTime->now and saves any changes made to the role back to the underlying store.
my $role = $provider->create(\%data); $role->description('My New Role'); $provider->update($role);
Mango::Provider, Mango::Provider::DBIC, Mango::Role, DBIx::Class
Christopher H. Laco CPAN ID: CLACO claco@chrislaco.com http://today.icantfocus.com/blog/
To install Mango, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mango
CPAN shell
perl -MCPAN -e shell install Mango
For more information on module installation, please visit the detailed CPAN module installation guide.