view release on metacpan or search on metacpan
- sql/dbinit_Config.pm: add validations to components table
- REST.pm->reset_db: add validations to SQL_COMPONENT_INSERT
- Model/Component.pm: add validations property
- t/dispatch/component.t: add validations property
- Build.PL: require App::Dochazka::Common 0.199 for component validations
- Fix bug "genreport resource does not validate parameters" (#53)
- genreport resource: apply validations, if any
- REST/Dispatch.pm->handler_genreport(): vet parameters more carefully
0.517 2016-01-11 00:29 CET
- config/Component_Config.pm: use Data::Dumper in component
- config/Component_Config.pm: beginnings of monthly report template
- t/model/tempintvls.t: change Util::Date to Holiday
- Dispatch.pm->handler_genreport(): refactor function
- Revamp Docker testing environment:
- version.plx: Perl script to print App::Dochazka::REST version
- .gitignore: ignore docker/Dockerfile
- bin/dochazka-dbinit: add database reset script
- docker: Makefile to generate 3 different images from a single
Dockerfile.in
- docker-test.sh: adapt to current state
config/Component_Config.pm view on Meta::CPAN
{
path => 'sample/local_time.mc',
source => 'Hello! The local time is <% scalar(localtime) %>.',
acl => 'passerby',
},
{
path => 'sample/site_param.mc',
source => <<'EOS',
<%class>
has 'param' => (isa => 'Str', required => 1);
use Data::Dumper;
</%class>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Dochazka Site Param</title>
</head>
<body>
<pre>
$site_param_name = '<% $.param %>';
<% Data::Dumper->Dump( [ $site->get($.param) ], [ 'site_param_value' ] ) %>
</pre>
</body>
</html>
EOS
acl => 'admin',
validations => q/{ 'param' => { 'type' => SCALAR } }/,
},
{
path => 'suse-cz-monthly.mc',
source => <<'EOS',
<%class>
has 'employee' => (isa => 'HashRef', required => 1);
has 'tsrange' => (isa => 'Str', required => 1);
use Data::Dumper;
</%class>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Dochazka Monthly Report</title>
</head>
<body>
<pre>
<% Data::Dumper->Dump( [ $.employee ], [ 'employee' ] ) %>
$tsrange = '<% $.tsrange %>';
</pre>
</body>
</html>
EOS
acl => 'active',
validations => q/
{
employee => { type => HASHREF },
tsrange => { type => SCALAR },
ext/helpers/docgen.plx view on Meta::CPAN
#
# -------------------------------------------------------------------------
use 5.014;
use strict;
use warnings;
use App::CELL qw( $site );
use App::Dochazka::REST;
use App::Dochazka::REST::Dispatch;
use Data::Dumper;
use Web::MREST;
use Web::MREST::Dispatch;
use Web::MREST::InitRouter qw( $resources );
my $dispatch_object = bless {}, 'App::Dochazka::REST::Dispatch';
sub init {
my $status = Web::MREST::init( distro => 'App-Dochazka-REST' );
die $status->text unless $status->ok;
lib/App/Dochazka/REST.pm view on Meta::CPAN
# *************************************************************************
package App::Dochazka::REST;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $core $site );
use App::Dochazka::REST::ConnBank qw( $dbix_conn conn_status );
use Data::Dumper;
use File::Path;
use File::ShareDir;
use File::Spec;
use Log::Any::Adapter;
use Params::Validate qw( :all );
use Try::Tiny;
use Web::Machine;
use Web::MREST;
use Web::MREST::CLI qw( normalize_filespec );
lib/App/Dochazka/REST/ACL.pm view on Meta::CPAN
#
# ACL routines
package App::Dochazka::REST::ACL;
use strict;
use warnings;
use App::CELL qw( $CELL $log );
use App::Dochazka::REST::Model::Employee;
use Data::Dumper;
use Params::Validate qw( :all );
=head1 NAME
App::Dochazka::REST::ACL - ACL module
lib/App/Dochazka/REST/Auth.pm view on Meta::CPAN
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST;
use App::Dochazka::REST::ConnBank qw( $dbix_conn conn_status );
use App::Dochazka::REST::ACL qw( check_acl );
use App::Dochazka::REST::LDAP qw( ldap_exists ldap_search ldap_auth );
use App::Dochazka::REST::Model::Employee qw( autocreate_employee nick_exists );
use Authen::Passphrase::SaltedDigest;
use Data::Dumper;
use Params::Validate qw(:all);
use Try::Tiny;
use Web::Machine::Util qw( create_header );
use Web::MREST::InitRouter qw( $resources );
# methods/attributes not defined in this module will be inherited from:
use parent 'Web::MREST::Entity';
lib/App/Dochazka/REST/Dispatch.pm view on Meta::CPAN
select_set_of_single_scalar_rows
split_tsrange
timestamp_delta_plus
);
use App::Dochazka::REST::ResourceDefs;
use App::Dochazka::REST::Shared qw( :ALL ); # all the shared_* functions
use App::Dochazka::REST::Holiday qw(
holidays_and_weekends
holidays_in_daterange
);
use Data::Dumper;
use File::Path qw( mkpath rmtree );
use Module::Runtime qw( use_module );
use Params::Validate qw( :all );
use Try::Tiny;
use Web::MREST::InitRouter qw( $router $resources );
use Web::MREST::Util qw( pod_to_html pod_to_text );
use parent 'App::Dochazka::REST::Auth';
lib/App/Dochazka/REST/Fillup.pm view on Meta::CPAN
);
use App::Dochazka::REST::Holiday qw(
calculate_hours
canon_date_diff
canon_to_ymd
get_tomorrow
holidays_in_daterange
tsrange_to_dates_and_times
ymd_to_canon
);
use Data::Dumper;
use Date::Calc qw(
Add_Delta_Days
Date_to_Days
Day_of_Week
check_date
);
use JSON qw( decode_json );
use Params::Validate qw( :all );
use Try::Tiny;
lib/App/Dochazka/REST/Model/Employee.pm view on Meta::CPAN
cud
load
load_multiple
noof
priv_by_eid
schedule_by_eid
select_single
select_set_of_single_scalar_rows
);
use Carp;
use Data::Dumper;
use DBI qw(:sql_types);
use Params::Validate qw( :all );
use Try::Tiny;
# send DBI warnings to the log
$SIG{__WARN__} = sub {
$log->notice( $_[0] );
};
# we get 'spawn', 'reset', and accessors from parent
lib/App/Dochazka/REST/Model/Interval.pm view on Meta::CPAN
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# *************************************************************************
package App::Dochazka::REST::Model::Interval;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use Data::Dumper;
use App::Dochazka::REST::Model::Activity qw( code_by_aid );
use App::Dochazka::REST::Model::Lock qw( count_locks_in_tsrange );
use App::Dochazka::REST::Model::Shared qw(
canonicalize_tsrange
cud
cud_generic
load
load_multiple
select_single
tsrange_intersection
lib/App/Dochazka/REST/Model/Lock.pm view on Meta::CPAN
# POSSIBILITY OF SUCH DAMAGE.
# *************************************************************************
package App::Dochazka::REST::Model::Lock;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::Model::Shared qw( cud load load_multiple );
use Data::Dumper;
use Params::Validate qw( :all );
# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Lock';
=head1 NAME
lib/App/Dochazka/REST/Model/Privhistory.pm view on Meta::CPAN
# POSSIBILITY OF SUCH DAMAGE.
# *************************************************************************
package App::Dochazka::REST::Model::Privhistory;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::Model::Shared qw( cud get_history load );
use Data::Dumper;
use Params::Validate qw( :all );
use Try::Tiny;
# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Privhistory';
=head1 NAME
lib/App/Dochazka/REST/Model/Schedhistory.pm view on Meta::CPAN
# POSSIBILITY OF SUCH DAMAGE.
# *************************************************************************
package App::Dochazka::REST::Model::Schedhistory;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::Model::Shared qw( cud get_history load );
use Data::Dumper;
use Params::Validate qw( :all );
# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Schedhistory';
=head1 NAME
lib/App/Dochazka/REST/Model/Schedintvls.pm view on Meta::CPAN
# *************************************************************************
package App::Dochazka::REST::Model::Schedintvls;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::ConnBank qw( $dbix_conn );
use App::Dochazka::REST::Model::Shared;
use Data::Dumper;
use JSON;
use Params::Validate qw( :all );
use Try::Tiny;
# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Schedintvls';
lib/App/Dochazka/REST/Model/Schedule.pm view on Meta::CPAN
# POSSIBILITY OF SUCH DAMAGE.
# *************************************************************************
package App::Dochazka::REST::Model::Schedule;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::Model::Shared qw( cud decode_schedule_json load load_multiple select_single );
use Data::Dumper;
use JSON;
use Params::Validate qw( :all );
use Try::Tiny;
# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Schedule';
lib/App/Dochazka/REST/Model/Shared.pm view on Meta::CPAN
# POSSIBILITY OF SUCH DAMAGE.
# *************************************************************************
package App::Dochazka::REST::Model::Shared;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use Data::Dumper;
use JSON;
use Params::Validate qw( :all );
use Try::Tiny;
=head1 NAME
App::Dochazka::REST::Model::Shared - functions shared by several modules within
lib/App/Dochazka/REST/Model/Tempintvl.pm view on Meta::CPAN
use strict;
use warnings;
use App::CELL qw( $CELL $log $site );
use App::Dochazka::REST::Model::Shared qw(
canonicalize_tsrange
cud
load_multiple
tsrange_intersection
);
use Data::Dumper;
use Params::Validate qw( :all );
# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Tempintvl';
=head1 NAME
lib/App/Dochazka/REST/Shared.pm view on Meta::CPAN
use App::Dochazka::REST::ConnBank qw( conn_status );
use App::Dochazka::REST::Model::Activity;
use App::Dochazka::REST::Model::Employee;
use App::Dochazka::REST::Model::Interval;
use App::Dochazka::REST::Model::Lock;
use App::Dochazka::REST::Model::Privhistory;
use App::Dochazka::REST::Model::Schedhistory;
use App::Dochazka::REST::Model::Schedule;
use App::Dochazka::REST::Model::Shared qw( priv_by_eid schedule_by_eid );
use App::Dochazka::REST::Util qw( hash_the_password pre_update_comparison );
use Data::Dumper;
use Params::Validate qw( :all );
use Try::Tiny;
my $fail = $CELL->status_not_ok;
=head1 NAME
App::Dochazka::REST::Dispatch::Shared - Shared dispatch functions
lib/App/Dochazka/REST/Test.pm view on Meta::CPAN
use App::Dochazka::REST;
use App::Dochazka::REST::Dispatch;
use App::Dochazka::REST::ConnBank qw( $dbix_conn conn_up );
use App::Dochazka::REST::Util qw( hash_the_password );
use App::Dochazka::REST::Model::Activity;
use App::Dochazka::REST::Model::Component;
use App::Dochazka::REST::Model::Privhistory qw( get_privhistory );
use App::Dochazka::REST::Model::Schedhistory qw( get_schedhistory );
use App::Dochazka::REST::Model::Shared qw( cud_generic noof select_single );
use Authen::Passphrase::SaltedDigest;
use Data::Dumper;
use HTTP::Request::Common qw( GET PUT POST DELETE );
use JSON;
use Params::Validate qw( :all );
use Test::JSON;
use Test::More;
use Try::Tiny;
use Web::MREST;
t/dispatch/001-resource.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::CELL::Status;
use App::Dochazka::REST::Test;
use Data::Dumper;
use HTTP::Request::Common qw( GET PUT POST DELETE );
use JSON;
use Plack::Test;
use Scalar::Util qw( blessed );
use Test::Fatal;
use Test::JSON;
use Test::More;
use Test::Warnings;
use Web::MREST::Resource;
t/dispatch/activity.t view on Meta::CPAN
#
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
note( 'initialize, connect to database, and set up a testing plan' );
my $app = initialize_regression_test();
note( 'instantiate Plack::Test object' );
t/dispatch/component.t view on Meta::CPAN
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::Dochazka::REST::ConnBank qw( $dbix_conn );
use App::Dochazka::REST::Mason qw( $comp_root );
use App::Dochazka::REST::Model::Component qw( path_exists );
use App::Dochazka::REST::Test;
use Data::Dumper;
use File::Slurp;
use File::Spec;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
note( 'initialize, connect to database, and set up a testing plan' );
my $app = initialize_regression_test();
t/dispatch/employee.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use utf8;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::Dochazka::REST::ConnBank qw( $dbix_conn );
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
note( 'initialize, connect to database, and set up a testing plan' );
my $app = initialize_regression_test();
note( 'check a random site param' );
t/dispatch/fillup.t view on Meta::CPAN
#
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
note( 'initialize, connect to database, and set up a testing plan' );
my $app = initialize_regression_test();
note( 'instantiate Plack::Test object' );
t/dispatch/genreport.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::Dochazka::REST::ConnBank qw( $dbix_conn );
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::More;
use Test::Warnings;
note( 'initialize, connect to database, and set up a testing plan' );
my $app = initialize_regression_test();
note( 'instantiate Plack::Test object' );
my $test = Plack::Test->create( $app );
t/dispatch/history-bug.t view on Meta::CPAN
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $meta $site );
use App::Dochazka::Common qw( $today );
use App::Dochazka::REST::ConnBank qw( $dbix_conn );
use App::Dochazka::REST::Model::Schedule;
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::More;
use Test::Warnings;
note( 'initialize, connect to database, and set up a testing plan' );
my $app = initialize_regression_test();
note( 'instantiate Plack::Test object' );
my $test = Plack::Test->create( $app );
t/dispatch/history.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $meta $site );
use App::Dochazka::REST::Model::Privhistory;
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
note( 'initialize, connect to database, and set up a testing plan' );
my $app = initialize_regression_test();
t/dispatch/holiday.t view on Meta::CPAN
#
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $meta $site );
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
#plan skip_all => "WIP";
note( "initialize, connect to database, and set up a testing plan" );
my $app = initialize_regression_test();
t/dispatch/interval_lock.t view on Meta::CPAN
#
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
my $illegal = qr/illegal attendance interval/;
note( "initialize, connect to database, and set up a testing plan" );
t/dispatch/interval_newline.t view on Meta::CPAN
#
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $log $meta $site );
use App::Dochazka::REST::Test;
use Data::Dumper;
use JSON;
use Plack::Test;
use Test::JSON;
use Test::More;
use Test::Warnings;
plan skip_all => "WIP";
note( "initialize, connect to database, and set up a testing plan" );
my $app = initialize_regression_test();