The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Role::Pg::Roles - Client Role for handling PostgreSQL Roles

VERSION

version 0.001

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

 $self->create(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 is then created with an encrypted password.

drop

 $self->drop(role => 'me');

Drops a role.

add

 $self->add(group => 'group', member => 'me');

Adds a member to a group. A member can be a user or a group

remove

 $self->remove(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

 $self->set(role => 'elvis');

Assume another role.

reset

 $self->reset;

Back to your old self.

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.