NAME

Mojolicious::Plugin::RoutesAuthDBI::Access - Generation routes, authentication and controll access to routes trought sintax of ->over(...), see Mojolicious::Routes::Route#over

SYNOPSIS

$app->plugin('RoutesAuthDBI', 
    dbh => $app->dbh,
    auth => {...},
    access => {< options below >},
);
  • namespace - default 'Mojolicious::Plugin::RoutesAuthDBI',

  • module - default 'Access' (this module),

    Both above options determining the module which will play as manager of authentication, accessing and generate routing from DBI source.

  • fail_auth_cb = sub {my $c = shift;...}

    This callback invoke when request need auth route but authentication was failure.

  • fail_access_cb = sub {my ($c, $route, $r_hash) = @_;...}

    This callback invoke when request need auth route but access was failure. $route - Mojolicious::Routes::Route object, $r_hash - route hashref db item.

EXPORT SUBS

  • load_user($c, $uid) - fetch user record from table users by COOKIES. Import for Mojolicious::Plugin::Authentication. Required.

  • validate_user($c, $login, $pass, $extradata) - fetch user record from table users by Mojolicious::Plugin::Authentication. Required.

head1 METHODS NEEDS IN PLUGIN

  • init_class() - make initialization of class vars: $dbh, $sql, $init_conf. Return $self object controller;

  • apply_route($self, $app, $r_hash) - insert to app->routes an hash item $r_hash. Return new Mojolicious route;

  • table_routes() - fetch records from table routes. Return arrayref of hashrefs records.

  • load_user_roles($self, $c, $uid) - fetch records roles for auth user. Return hashref record.

  • access_route($self, $c, $id1, $id2) - make check access to route by $id1 for user roles ids $id2 arrayref. Return false for deny access or true - allow access.

  • access_controller($self, $c, $r, $id2) - make check access to route by special route record with request=NULL by $r->{namespace} and $r->{controller} for user roles ids $id2 arrayref. Return false for deny access or true - allow access to all actions of this controller.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 12:

=pod directives shouldn't be over one line long! Ignoring all 2 lines of content