NAME
Role::Pg::Roles - Client Role for handling PostgreSQL Roles
VERSION
version 0.002
name
role::pg::roles
description
this role handles the use of roles in a postgresql database.
attributes
roles_dbh
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.
METHODS
create_role
$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.
drop_role
$self->drop_role(role => 'me');
Drops a role.
add_to_group
$self->add_to_group(group => 'group', member => 'me');
Adds a member to a group. A member can be a user or a group
remove_from_group
$self->remove_from_group(group => 'group', member => 'me');
Removes a member from a group.
check_user
my $roles = $self->check_user(user => 'me', password => 'trust me!');
Checks if there is a user with the given password
roles
my $roles = $self->roles(user => 'me');
Returns an arrayref with all the roles the user is a member of.
member_of
print "yep" if $self->member_of(user => 'me', group => 'group');
Returns true if user is member of group.
set_role
$self->set_role(role => 'elvis');
Assume another role.
reset_role
$self->reset;
Back to your old self.
set_password
$self->set_password(role => 'elvis', password => 'King');
Set (a new) password.
set_privilege
$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).
AUTHOR
Kaare Rasmussen <kaare@cpan.org>.
COPYRIGHT
Copyright (C) 2014, Kaare Rasmussen
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
AUTHOR
Kaare Rasmussen <kaare at cpan dot net>
COPYRIGHT AND LICENSE
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.