Warn

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

Mojolicious::Plugin::RoutesAuthDBI::POS::Pg

¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !

NAME

Mojolicious::Plugin::RoutesAuthDBI::POS::Pg - POS for PostgreSQL.

DB DESIGN DIAGRAM

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

SYNOPSIS

use Mojolicious::Plugin::RoutesAuthDBI::POS::Pg;

my $sql = Mojolicious::Plugin::RoutesAuthDBI::POS::Pg->instance;
my $sth = $dbh->prepare($sql->{'name foo'});

SEE ALSO

DBIx::POS

SQL definitions

For access methods

  • user

    select *
    from users
    where id = ? or login=?
  • apply routes

    select r.*, ac.controller, ac.namespace, ac.action, ac.callback, ac.id as action_id, ac.controller_id, ac.namespace_id
    from routes r
      join refs rf on r.id=rf.id1
      join 
      (select a.*, c.controller, c.id as controller_id, n.namespace, n.id as namespace_id
        from actions a 
        left join refs r on a.id=r.id2
        left join controllers c on c.id=r.id1
        left join refs r2 on c.id=r2.id2
        left join namespaces n on n.id=r2.id1
      ) ac on rf.id2=ac.id
    order by r.order_by, r.ts;
  • user roles

    select g.*
    from
      roles g
      join refs r on g.id=r.id1
    where r.id2=?;
    --and coalesce(g.disable, 0::bit) <> 1::bit
  • cnt refs

    select count(*)
    from refs
    where id1 = any(?) and id2 = ANY(?);
  • access action

    select count(r.*)
    from
      refs rc 
      join actions a on a.id=rc.id2
      join refs r on a.id=r.id1
      ---join roles o on o.id=r.id2
    where
      rc.id1=? ---controller id
      and a.action=?
      and r.id2=any(?) --- roles ids
      ---and coalesce(o.disable, 0::bit) <> 1::bit
    ;
  • access namespace

    select count(n.*)
    from 
      namespaces n
      join refs r on n.id=r.id1
      ---join roles o on r.id2=o.id
    where
      n.namespace=?
      and r.id2=any(?) --- roles ids
      ---and coalesce(o.disable, 0::bit) <> 1::bit
    ;
  • access role

    select count(*)
    from roles
    where (id = ? or name = ?)
      and id = any(?)
      and coalesce(disable, 0::bit) <> 1::bit
    ;

For administration actions (controller)

  • new user

    insert into users (login, pass) values (?,?)
    returning *;
  • role

    select *
    from roles
    where id=? or lower(name)=?
  • new role

    insert into roles (name) values (?)
    returning *;
  • dsbl/enbl role

    update roles set disable=?::bit where id=? or lower(name)=?
    returning *;
  • ref

    select *
    from refs
    where id1=? and id2=?;
  • new ref

    insert into refs (id1,id2) values (?,?)
    returning *;
  • del ref

    delete from refs
    where id1=? and id2=?
    returning *;
  • controller

    select c.*, n.namespace, n.id as namespace_id, n.descr as namespace_descr
    from
      controllers c
      left join refs r on c.id=r.id2
      left join namespaces n on n.id=r.id1
    
    where
      c.controller=?
      and (n.namespace=? or (?::varchar is null and n.id is null))
      
  • new controller

    insert into controllers (controller, descr)
    values (?,?)
    returning *;
  • new route

    insert into routes (request, name, auth, descr, disable, order_by)
    values (?,?,?,?,?,?,?,?,?)
    returning *;
  • role users

    select u.*
    from
      users u
      join refs r on u.id=r.id2
    where r.id1=?;
  • role routes

    select t.*
    from
      routes t
      join refs r on t.id=r.id1
    where r.id2=?;
  • controllers

    select c.*, n.namespace, n.id as namespace_id, n.descr as namespace_descr
      from controllers c
      left join refs r on c.id=r.id2
      left join namespaces n on n.id=r.id1
      ;
  • namespaces

    select *
    from namespaces;
  • namespace

    select *
    from namespaces
    where namespace = ?;
  • new namespace

    insert into namespaces (namespace, descr) values (?,?)
    returning *;
  • actions

    select a.*, c.namespace, c.controller
    from actions a
      left join refs r on a.id=r.id2
      left join controllers c on c.id=r.id1
  • ыудусе * акщь тест!ж

75 POD Errors

The following errors were encountered while parsing the POD:

Around line 42:

Unknown directive: =name

Around line 44:

Unknown directive: =desc

Around line 46:

Unknown directive: =sql

Around line 54:

Unknown directive: =name

Around line 56:

Unknown directive: =desc

Around line 58:

Unknown directive: =sql

Around line 75:

Unknown directive: =name

Around line 77:

Unknown directive: =desc

Around line 79:

Unknown directive: =sql

Around line 90:

Unknown directive: =name

Around line 92:

Unknown directive: =desc

Around line 94:

Unknown directive: =sql

Around line 102:

Unknown directive: =name

Around line 104:

Unknown directive: =desc

Around line 106:

Unknown directive: =sql

Around line 124:

Unknown directive: =name

Around line 126:

Unknown directive: =desc

Around line 128:

Unknown directive: =sql

Around line 143:

Unknown directive: =name

Around line 145:

Unknown directive: =desc

Around line 147:

Unknown directive: =sql

Around line 164:

Unknown directive: =name

Around line 166:

Unknown directive: =desc

Around line 168:

Unknown directive: =sql

Around line 175:

Unknown directive: =name

Around line 177:

Unknown directive: =desc

Around line 179:

Unknown directive: =sql

Around line 187:

Unknown directive: =name

Around line 189:

Unknown directive: =desc

Around line 191:

Unknown directive: =sql

Around line 198:

Unknown directive: =name

Around line 200:

Unknown directive: =desc

Around line 202:

Unknown directive: =sql

Around line 209:

Unknown directive: =name

Around line 211:

Unknown directive: =desc

Around line 213:

Unknown directive: =sql

Around line 221:

Unknown directive: =name

Around line 223:

Unknown directive: =desc

Around line 225:

Unknown directive: =sql

Around line 233:

Unknown directive: =name

Around line 235:

Unknown directive: =desc

Around line 237:

Unknown directive: =sql

Around line 245:

Unknown directive: =name

Around line 247:

Unknown directive: =desc

Around line 249:

Unknown directive: =sql

Around line 264:

Unknown directive: =name

Around line 266:

Unknown directive: =desc

Around line 268:

Unknown directive: =sql

Around line 276:

Unknown directive: =name

Around line 278:

Unknown directive: =desc

Around line 280:

Unknown directive: =sql

Around line 288:

Unknown directive: =name

Around line 290:

Unknown directive: =desc

Around line 292:

Unknown directive: =sql

Around line 302:

Unknown directive: =name

Around line 304:

Unknown directive: =desc

Around line 306:

Unknown directive: =sql

Around line 317:

Unknown directive: =name

Around line 319:

Unknown directive: =desc

Around line 321:

Unknown directive: =sql

Around line 331:

Unknown directive: =name

Around line 333:

Unknown directive: =desc

Around line 335:

Unknown directive: =sql

Around line 342:

Unknown directive: =name

Around line 344:

Unknown directive: =desc

Around line 346:

Unknown directive: =sql

Around line 354:

Unknown directive: =name

Around line 356:

Unknown directive: =desc

Around line 358:

Unknown directive: =sql

Around line 366:

Unknown directive: =name

Around line 368:

Unknown directive: =desc

Around line 370:

Unknown directive: =sql

Around line 379:

Unknown directive: =name

Around line 381:

Unknown directive: =desc

Around line 383:

Unknown directive: =sql