Warn

POD ERRORS here is normal because DBIx::POS used.

Mojolicious::Plugin::RoutesAuthDBI::Install

¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !

NAME

Mojolicious::Plugin::RoutesAuthDBI::Install - is a Mojolicious::Controller for installation instructions. DB schema (PostgreSQL) and sample app.

DB DESIGN DIAGRAM

See https://github.com/mche/Mojolicious-Plugin-RoutesAuthDBI/blob/master/Diagram.svg

Manual

$ perl -e "use Mojo::Base 'Mojolicious'; __PACKAGE__->new()->start(); sub startup {shift->routes->route('/')->to('install#manual', namespace=>'Mojolicious::Plugin::RoutesAuthDBI');}" get / 2>/dev/null

DB schema (postgresql)

View schema

$ perl -e "use Mojo::Base 'Mojolicious'; __PACKAGE__->new()->start(); sub startup {shift->routes->route('/')->to('install#schema', namespace=>'Mojolicious::Plugin::RoutesAuthDBI');}" get / 2>/dev/null

Apply schema

$ perl -e "use Mojo::Base 'Mojolicious'; __PACKAGE__->new()->start(); sub startup {shift->routes->route('/')->to('install#schema', namespace=>'Mojolicious::Plugin::RoutesAuthDBI');}" get / 2>/dev/null | psql -d <dbname>

Sample test-app.pl

$ perl -e "use Mojo::Base 'Mojolicious'; __PACKAGE__->new()->start(); sub startup {shift->routes->route('/')->to('install#test_app', namespace=>'Mojolicious::Plugin::RoutesAuthDBI');}" get / 2>/dev/null > test-app.pl

Define DBI->connect(.........) and some plugin options in test-app.pl

Check list of admin routes:

$ perl test-app.pl routes

Start app

$ perl test-app.pl daemon

Trust url for admin-user creation:

$ perl test-app.pl get /<pluginconf->{admin}{prefix}>/<pluginconf->{admin}{trust}>/user/new/<new admin login>/<admin pass> 2>/dev/null

Sign in by browser:

Go to http://127.0.0.1:3000/sign/in/<new admin login>/<admin pass>

Admin index:

Go to http://127.0.0.1:3000/<pluginconf->{admin}{prefix}>

Administration of system ready!

DB design

  • Sequence

    CREATE SEQUENCE ID;-- one sequence for all tables id
  • Routes

    CREATE TABLE routes (
      id integer default nextval('ID'::regclass) not null primary key,
      ts timestamp without time zone default now() not null,
      request character varying not null,
      name character varying not null unique,
      descr text null,
      auth bit(1) null,
      disable bit(1) null,
      order_by int null
    );
  • Namespaces

    create table namespaces (
      id integer default nextval('ID'::regclass) not null primary key,
      ts timestamp without time zone default now() not null,
      namespace character varying not null unique,
      descr text null
    );
  • Controllers

    create table controllers (
      id integer default nextval('ID'::regclass) not null primary key,
      ts timestamp without time zone default now() not null,
      controller character varying not null,
      descr text null
    );
  • Actions

    create table actions (
      id integer default nextval('ID'::regclass) not null primary key,
      ts timestamp without time zone default now() not null,
      action character varying not null,
      callback text null,
      descr text null
    );
  • Users

    create table users (
      id int default nextval('ID'::regclass) not null  primary key,
      ts timestamp without time zone default now() not null,
      login varchar not null unique,
      pass varchar not null,
      disable bit(1)
    );
  • Roles

    create table roles (
      id int default nextval('ID'::regclass) not null  primary key,
      ts timestamp without time zone default now() not null,
      name varchar not null unique,
      disable bit(1)
    );
  • Refs

    create table refs (
      id int default nextval('ID'::regclass) not null  primary key,
      ts timestamp without time zone default now() not null,
      id1 int not null,
      id2 int not null,
      unique(id1, id2)
    );
    create index on refs (id2);

Drop schema

drop table refs;
drop table users;
drop table roles;
drop table routes;
drop table controllers;
drop table actions;
drop table namespaces;
drop sequence ID;

27 POD Errors

The following errors were encountered while parsing the POD:

Around line 157:

Unknown directive: =name

Around line 159:

Unknown directive: =desc

Around line 161:

Unknown directive: =sql

Around line 167:

Unknown directive: =name

Around line 169:

Unknown directive: =desc

Around line 171:

Unknown directive: =sql

Around line 186:

Unknown directive: =name

Around line 188:

Unknown directive: =desc

Around line 190:

Unknown directive: =sql

Around line 201:

Unknown directive: =name

Around line 203:

Unknown directive: =desc

Around line 205:

Unknown directive: =sql

Around line 216:

Unknown directive: =name

Around line 218:

Unknown directive: =desc

Around line 220:

Unknown directive: =sql

Around line 232:

Unknown directive: =name

Around line 234:

Unknown directive: =desc

Around line 236:

Unknown directive: =sql

Around line 248:

Unknown directive: =name

Around line 250:

Unknown directive: =desc

Around line 252:

Unknown directive: =sql

Around line 263:

Unknown directive: =name

Around line 265:

Unknown directive: =desc

Around line 267:

Unknown directive: =sql

Around line 282:

Unknown directive: =name

Around line 284:

Unknown directive: =desc

Around line 286:

Unknown directive: =sql