App-Dochazka-REST

 view release on metacpan or  search on metacpan

lib/App/Dochazka/REST/ResourceDefs.pm  view on Meta::CPAN

looked up from the database.

N.B. The value of the "schedule" property is just the SID, not the actual
schedule record.
EOH
    },

    # /employee/team
    'employee/team' =>
    {
        parent => 'employee',
        handler => {
            GET => 'handler_get_employee_team',
        },
        acl_profile => 'active', 
        cli => 'team',
        description => 'List nicks of the logged-in employee\'s team members',
        documentation => <<'EOH',
=pod

This resource enables supervisors to easily list the nicks of
employees in their team - i.e. their direct reports.
EOH
    },

};


=head2 Genreport resources

=cut

$defs->{'genreport'} = {

    # /genreport
    'genreport' => 
    {
        parent => '/',
        handler => {
            GET => 'handler_noop',
            POST => 'handler_genreport',
        },
        acl_profile => {
            GET => 'passerby',
            POST => 'admin',
        },
        cli => 'genreport',
        description => 'Generate reports',
        documentation => <<'EOH',
=pod

The "POST genreport" resource generates reports from Mason templates.
The resource takes a request body with one mandatory property, "path"
(corresponding to the path of a Mason component relative to the component
root), and one optional property, "parameters", which should be a hash
of parameter names and values.

The resource handler checks (1) if the component exists in the database,
(2) whether current employee has sufficient permissions to generate the
report (by comparing the employee's privlevel with the ACL profile of the
component), and (3) validates the parameters, if any, by applying the 
validation rules specified in the component object. Iff all of these
conditions are met, the component is called with the provided parameters.
EOH
    },

};


=head2 History resources

=cut

$defs->{'history'} = {

    'priv/history' => 
    {
        parent => 'priv',
        handler => 'handler_noop',
        cli => 'priv history',
        description => 'Privilege history resources',
        documentation => <<'EOH',
=pod

This resource presents a list of subresources, all related to privilege histories.
EOH
    },

    'schedule/history' => 
    {
        parent => 'schedule',
        handler => 'handler_noop',
        cli => 'schedule history',
        description => 'Schedule history resources',
        documentation => <<'EOH',
=pod

This resource presents a list of subresources, all related to schedule histories.
EOH
    },

    'priv/history/eid/:eid' =>
    { 
        parent => 'priv/history',
        handler => {
            GET => 'handler_history_get_multiple',
            POST => 'handler_history_post',
        },
        acl_profile => {
            GET => 'inactive',
            POST => 'admin',
        },
        cli => 'priv history eid $EID [$JSON]',
        validations => {
            'eid' => 'Int',
        },
        description => 'Retrieves entire history of privilege level changes for employee with the given EID (GET); or, with an appropriate content body, adds (POST) a record to employee\'s privhistory',
        documentation => <<'EOH',
=pod

Retrieves entire history of privilege level changes for employee with the given



( run in 1.156 second using v1.01-cache-2.11-cpan-524268b4103 )