Role::Pg::Roles - Client Role for handling PostgreSQL Roles
version 0.002
role::pg::roles
this role handles the use of roles in a postgresql database.
role::pg::roles tries to guess your dbh. if it isn't a standard dbi::db named dbh, or constructed in a dbix::class schema called schema, you have to return the dbh from _build_roles_dbh.
$self->create_role(role => 'me', password => 'safety');
Creates a role. The role can be seen as either a user or a group.
An optional password can be added. The user (or group) is then created with an encrypted password.
$self->drop_role(role => 'me');
Drops a role.
$self->add_to_group(group => 'group', member => 'me');
Adds a member to a group. A member can be a user or a group
$self->remove_from_group(group => 'group', member => 'me');
Removes a member from a group.
my $roles = $self->check_user(user => 'me', password => 'trust me!');
Checks if there is a user with the given password
my $roles = $self->roles(user => 'me');
Returns an arrayref with all the roles the user is a member of.
print "yep" if $self->member_of(user => 'me', group => 'group');
Returns true if user is member of group.
$self->set_role(role => 'elvis');
Assume another role.
$self->reset;
Back to your old self.
$self->set_password(role => 'elvis', password => 'King');
Set (a new) password.
$self->set_privilege(role => 'elvis', privilege => 'createrole');
Add a privilege to (or remove from) a role.
Priviles can be any of
SUPERUSER CREATEDB CREATEROLE CREATEUSER INHERIT LOGIN REPLICATION
To remove a privilege, prepend with "NO" (like NOCREATEROLE).
Kaare Rasmussen <kaare@cpan.org>.
Copyright (C) 2014, Kaare Rasmussen
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
Kaare Rasmussen <kaare at cpan dot net>
This software is copyright (c) 2014 by Kaare Rasmussen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Role::Pg::Roles, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Role::Pg::Roles
CPAN shell
perl -MCPAN -e shell install Role::Pg::Roles
For more information on module installation, please visit the detailed CPAN module installation guide.