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

App::Dochazka::REST::Dispatch - path dispatch

VERSION

Version 0.099

DESCRIPTION

This module contains a single function, is_auth, that processes the "path" from the HTTP request.

is_auth

Takes a PARAMHASH with the following mandatory parameters:

    'eid'     the EID of the employee making the request
    'priv'    current privilege level of that employee
    'method'  the HTTP method being used to access the resource
    'path'    the path string

Returns a status object, the level of which can be either 'OK' (authorized) or 'NOT_OK' (not authorized). If the status is 'OK', the payload will contain a reference to a hash that will look like this:

    {
        rout => CODEREF,
        args => [ ... ],
    }

where 'rout' is a reference to the subroutine to be run to obtain the JSON string to be placed in the HTTP response, and 'args' is a list of arguments to be provided to that function. Also, the extraneous URL part (if any) is appended to the status object as 'extra'.