NAME

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

VERSION

version 0.01

SYNOPSIS

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

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

my $new_context = $context->add(
    context_name        => 'test',
    context_description => 'hallo', 
);

my $updated_context = $new_context->update(
    context_name        => 'ernie',
    context_description => 'bert',
);

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

# delete context
$new_context->delete;

ATTRIBUTES

  • dbh

  • context_name

  • context_description

  • context_id

  • error

METHODS

load

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

add

my $new_context = $context->add(
    contextname      => 'test',
    context_password => 'hallo', 
);

update

my $updated_context = $new_context->update(
    contextname      => 'ernie',
    context_password => 'bert',
);

delete

$context->delete;

set_user_roles

$context->set_user_roles(
    user_id => 123,
    roles   => [
        123,
        456,
        789,
    ],
);

set_role_users

$context->set_role_users(
    role_id => 123,
    users   => [
        123,
        456,
        789,
    ],
);

role_users

my @user_ids = $context->role_users(
    role_id => 123,
);

user_roles

my @role_ids = $context->user_roles(
    user_id => 123,
);

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)