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

Mojolicious::Plugin::ContextAuth::DB::Role - Role object for the ContextAuth database

VERSION

version 0.01

SYNOPSIS

    my $db = Mojolicious::Plugin::ContextAuth::DB->new(
        dsn => 'sqlite:' . $file,
    );

    my $role = Mojolicious::Plugin::ContextAuth::DB::role->new(
        dbh => $db->dbh,
    );

    my $new_role = $role->add(
        role_name        => 'test',
        role_description => 'hallo', 
    );

    my $updated_role = $new_role->update(
        role_name        => 'ernie',
        role_description => 'bert',
    );

    # create role object with data for role id 1
    my $found_role = $role->load( 1 );

    # delete role
    $new_role->delete;

ATTRIBUTES

  • dbh

  • role_name

  • role_description

  • role_id

  • error

METHODS

load

    # create role object with data for role id 1
    my $found_role = $role->load( 1 );

add

    my $new_role = $role->add(
        rolename      => 'test',
        role_password => 'hallo', 
    );

update

    my $updated_role = $new_role->update(
        rolename      => 'ernie',
        role_password => 'bert',
    );

delete

    $role->delete;

Search for roles...

    my @role_ids = $role->search(); # get all roles
    my @role_ids = $role->search(   # get all roles for a context
        context_id => 123,
    );

    my @role_ids = $role->search(
        role_name => { 'LIKE' => 'project%' },
    )

Returns a list of role ids if roles are found.

set_context_users

set_permissions

context_users

permissions

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Renee Baecker.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)