Commit 3a669167 authored by Yadd's avatar Yadd
Browse files

Temp

parent 642e98e1
...@@ -28,7 +28,7 @@ Build-Depends-Indep: libapache-session-perl, ...@@ -28,7 +28,7 @@ Build-Depends-Indep: libapache-session-perl,
libjson-perl, libjson-perl,
liblasso-perl, liblasso-perl,
libmime-tools-perl, libmime-tools-perl,
libmouse-perl, libmoo-perl,
libnet-cidr-lite-perl, libnet-cidr-lite-perl,
libnet-ldap-perl, libnet-ldap-perl,
libnet-openid-consumer-perl, libnet-openid-consumer-perl,
...@@ -197,7 +197,7 @@ Depends: ${misc:Depends}, ...@@ -197,7 +197,7 @@ Depends: ${misc:Depends},
libcrypt-rijndael-perl, libcrypt-rijndael-perl,
libhtml-template-perl, libhtml-template-perl,
libjson-perl, libjson-perl,
libmouse-perl, libmoo-perl,
libplack-perl, libplack-perl,
liburi-perl, liburi-perl,
libwww-perl libwww-perl
......
# debian/tests/runner launch pkg-perl-autopkgtest tests for each library # debian/tests/runner launch pkg-perl-autopkgtest tests for each library
Test-Command: ./debian/tests/runner build-deps Test-Command: ./debian/tests/runner build-deps
Depends: @, @builddeps@, pkg-perl-autopkgtest, libmouse-perl Depends: @, @builddeps@, pkg-perl-autopkgtest, libmoo-perl
Test-Command: ./debian/tests/runner runtime-deps Test-Command: ./debian/tests/runner runtime-deps
Depends: @, pkg-perl-autopkgtest, libmouse-perl Depends: @, pkg-perl-autopkgtest, libmoo-perl
# Use pkg-perl-autopkgtest test for runtime-deps-and-recommends # Use pkg-perl-autopkgtest test for runtime-deps-and-recommends
# Some portal suggested dependencies are added here # Some portal suggested dependencies are added here
...@@ -11,4 +11,4 @@ Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps-and-recommends ...@@ -11,4 +11,4 @@ Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps-and-recommends
Depends: @, @builddeps@, pkg-perl-autopkgtest, libyaml-perl, liblog-log4perl-perl, libauthen-pam-perl, libauthen-radius-perl, libweb-id-perl Depends: @, @builddeps@, pkg-perl-autopkgtest, libyaml-perl, liblog-log4perl-perl, libauthen-pam-perl, libauthen-radius-perl, libweb-id-perl
#Test-Command: ./debian/tests/runner heavy-deps #Test-Command: ./debian/tests/runner heavy-deps
#Depends: @, pkg-perl-autopkgtest, pkg-perl-autopkgtest-heavy, libmouse-perl #Depends: @, pkg-perl-autopkgtest, pkg-perl-autopkgtest-heavy, libmoo-perl
...@@ -10,27 +10,23 @@ our $VERSION = '2.0.0'; ...@@ -10,27 +10,23 @@ our $VERSION = '2.0.0';
use strict; use strict;
use Lemonldap::NG::Common::Session; use Lemonldap::NG::Common::Session;
use Mouse; use Moo;
use Digest::MD5 qw(md5_hex); use Digest::MD5 qw(md5_hex);
has 'storageModule' => ( has 'storageModule' => (
is => 'ro', is => 'ro',
isa => 'Str',
required => 1, required => 1,
); );
has 'storageModuleOptions' => ( has 'storageModuleOptions' => ( is => 'ro' );
is => 'ro',
isa => 'HashRef|Undef',
);
has code => ( is => 'rw', isa => 'Str' ); has code => ( is => 'rw' );
has md5 => ( is => 'rw', isa => 'Str' ); has md5 => ( is => 'rw' );
has image => ( is => 'rw', isa => 'Str' ); has image => ( is => 'rw' );
has size => ( is => 'ro', isa => 'Int' ); has size => ( is => 'ro' );
sub BUILD { sub BUILD {
...@@ -115,6 +111,4 @@ sub removeSession { ...@@ -115,6 +111,4 @@ sub removeSession {
return 0; return 0;
} }
no Mouse;
1; 1;
package Lemonldap::NG::Common::Cli; package Lemonldap::NG::Common::Cli;
use strict; use strict;
use Mouse; use Moo;
use Lemonldap::NG::Common::Conf; use Lemonldap::NG::Common::Conf;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
has confAccess => ( has confAccess => (
is => 'rw', is => 'rw',
builder => sub { lazy=>1,
builder => 1,
);
sub _build_confAccess {
my $res = Lemonldap::NG::Common::Conf->new( my $res = Lemonldap::NG::Common::Conf->new(
{ {
( (
...@@ -21,11 +24,9 @@ has confAccess => ( ...@@ -21,11 +24,9 @@ has confAccess => (
die $Lemonldap::NG::Common::Conf::msg unless ($res); die $Lemonldap::NG::Common::Conf::msg unless ($res);
return $res; return $res;
}, },
);
has cfgNum => ( has cfgNum => (
is => 'rw', is => 'rw',
isa => 'Int',
); );
sub info { sub info {
......
package Lemonldap::NG::Common::Combination::Parser; package Lemonldap::NG::Common::Combination::Parser;
use strict; use strict;
use Mouse; use Moo;
use Safe; use Safe;
use constant PE_OK => 0; use constant PE_OK => 0;
......
...@@ -2,14 +2,14 @@ package Lemonldap::NG::Common::Conf::AccessLib; ...@@ -2,14 +2,14 @@ package Lemonldap::NG::Common::Conf::AccessLib;
use 5.10.0; use 5.10.0;
use utf8; use utf8;
use Mouse; use Moo;
use Lemonldap::NG::Common::Conf; use Lemonldap::NG::Common::Conf;
has '_confAcc' => ( is => 'rw', isa => 'Lemonldap::NG::Common::Conf' ); has '_confAcc' => ( is => 'rw' );
has 'configStorage' => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); has 'configStorage' => ( is => 'rw', default => sub { {} } );
has 'currentConf' => ( is => 'rw', required => 1, default => sub { {} } ); has 'currentConf' => ( is => 'rw', required => 1, default => sub { {} } );
has 'protection' => ( is => 'rw', isa => 'Str', default => 'manager' ); has 'protection' => ( is => 'rw', default => sub { 'manager' } );
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
......
package Lemonldap::NG::Common::Conf::Compact; package Lemonldap::NG::Common::Conf::Compact;
use strict; use strict;
use Mouse; use Moo;
use Lemonldap::NG::Common::Conf::ReConstants; use Lemonldap::NG::Common::Conf::ReConstants;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
......
...@@ -2,7 +2,7 @@ package Lemonldap::NG::Common::Conf::RESTServer; ...@@ -2,7 +2,7 @@ package Lemonldap::NG::Common::Conf::RESTServer;
use strict; use strict;
use JSON 'from_json'; use JSON 'from_json';
use Mouse; use Moo;
use Lemonldap::NG::Common::Conf::Constants; use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::Conf::ReConstants; use Lemonldap::NG::Common::Conf::ReConstants;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Conf::SAML::Metadata; package Lemonldap::NG::Common::Conf::SAML::Metadata;
use strict; use strict;
use Mouse; use Moo;
use Crypt::OpenSSL::RSA; use Crypt::OpenSSL::RSA;
use Crypt::OpenSSL::X509; use Crypt::OpenSSL::X509;
use HTML::Template; use HTML::Template;
......
package Lemonldap::NG::Common::Module; package Lemonldap::NG::Common::Module;
use strict; use strict;
use Mouse; use Moo;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
......
package Lemonldap::NG::Common::Notifications; package Lemonldap::NG::Common::Notifications;
use strict; use strict;
use Mouse; use Moo;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
...@@ -20,7 +20,10 @@ sub import { ...@@ -20,7 +20,10 @@ sub import {
has notifField => ( has notifField => (
is => 'rw', is => 'rw',
builder => sub { lazy=>1,
builder => 1,
);
sub _build_notifField {
my $uid = my $uid =
$_[0]->conf->{notificationField} $_[0]->conf->{notificationField}
|| $_[0]->conf->{whatToTrace} || $_[0]->conf->{whatToTrace}
...@@ -28,7 +31,6 @@ has notifField => ( ...@@ -28,7 +31,6 @@ has notifField => (
$uid =~ s/^\$//; $uid =~ s/^\$//;
return $uid; return $uid;
} }
);
sub getNotifications { sub getNotifications {
my ( $self, $uid ) = @_; my ( $self, $uid ) = @_;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Notifications::DBI; package Lemonldap::NG::Common::Notifications::DBI;
use strict; use strict;
use Mouse; use Moo;
use Time::Local; use Time::Local;
use DBI; use DBI;
use Encode; use Encode;
...@@ -40,13 +40,15 @@ has dbiUser => ( ...@@ -40,13 +40,15 @@ has dbiUser => (
} }
); );
has dbiPassword => ( is => 'ro', default => '' ); has dbiPassword => ( is => 'ro', default => sub{''} );
# Database handle object # Database handle object
has _dbh => ( has _dbh => (
is => 'rw', is => 'rw',
lazy => 1, lazy => 1,
builder => sub { builder => 1,
);
sub _build__dbh {
my $self = shift; my $self = shift;
my $r = DBI->connect_cached( my $r = DBI->connect_cached(
$self->{dbiChain}, $self->{dbiUser}, $self->{dbiChain}, $self->{dbiUser},
...@@ -55,7 +57,6 @@ has _dbh => ( ...@@ -55,7 +57,6 @@ has _dbh => (
$self->logger->error($DBI::errstr) unless ($r); $self->logger->error($DBI::errstr) unless ($r);
return $r; return $r;
} }
);
# Current query # Current query
has sth => ( is => 'rw' ); has sth => ( is => 'rw' );
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Notifications::File; package Lemonldap::NG::Common::Notifications::File;
use strict; use strict;
use Mouse; use Moo;
use MIME::Base64; use MIME::Base64;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
...@@ -31,7 +31,7 @@ has table => ( ...@@ -31,7 +31,7 @@ has table => (
} }
); );
has fileNameSeparator => ( is => 'rw', default => '_' ); has fileNameSeparator => ( is => 'rw', default => sub{'_'} );
# Returns notifications corresponding to the user $uid. # Returns notifications corresponding to the user $uid.
# If $ref is set, returns only notification corresponding to this reference. # If $ref is set, returns only notification corresponding to this reference.
......
package Lemonldap::NG::Common::Notifications::JSON; package Lemonldap::NG::Common::Notifications::JSON;
use strict; use strict;
use Mouse; use Moo;
use JSON qw(from_json to_json); use JSON qw(from_json to_json);
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
package Lemonldap::NG::Common::Notifications::LDAP; package Lemonldap::NG::Common::Notifications::LDAP;
use strict; use strict;
use Mouse; use Moo;
use Time::Local; use Time::Local;
use MIME::Base64; use MIME::Base64;
use Net::LDAP; use Net::LDAP;
......
package Lemonldap::NG::Common::Notifications::XML; package Lemonldap::NG::Common::Notifications::XML;
use strict; use strict;
use Mouse; use Moo;
use XML::LibXML; use XML::LibXML;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
...@@ -9,10 +9,13 @@ our $VERSION = '2.0.0'; ...@@ -9,10 +9,13 @@ our $VERSION = '2.0.0';
# XML parser # XML parser
has parser => ( has parser => (
is => 'rw', is => 'rw',
builder => sub { lazy=>1,
builder => 1,
);
sub _build_parser {
return XML::LibXML->new(); return XML::LibXML->new();
} }
);
# Check XML data and insert new notifications. # Check XML data and insert new notifications.
# @param $xml XML string containing notification # @param $xml XML string containing notification
......
package Lemonldap::NG::Common::PSGI; package Lemonldap::NG::Common::PSGI;
use 5.10.0; use 5.10.0;
use Mouse; use Moo;
use JSON; use JSON;
use Lemonldap::NG::Common::PSGI::Constants; use Lemonldap::NG::Common::PSGI::Constants;
use Lemonldap::NG::Common::PSGI::Request; use Lemonldap::NG::Common::PSGI::Request;
...@@ -12,16 +12,16 @@ our $_json = JSON->new->allow_nonref; ...@@ -12,16 +12,16 @@ our $_json = JSON->new->allow_nonref;
# PROPERTIES # PROPERTIES
has error => ( is => 'rw', default => '' ); has error => ( is => 'rw', default => sub { '' } );
has languages => ( is => 'rw', isa => 'Str', default => 'en' ); has languages => ( is => 'rw', default => sub { 'en' } );
has logLevel => ( is => 'rw', isa => 'Str', default => 'info' ); has logLevel => ( is => 'rw', default => sub { 'info' } );
has portal => ( is => 'rw', isa => 'Str' ); has portal => ( is => 'rw' );
has staticPrefix => ( is => 'rw', isa => 'Str' ); has staticPrefix => ( is => 'rw' );
has templateDir => ( is => 'rw', isa => 'Str' ); has templateDir => ( is => 'rw' );
has links => ( is => 'rw', isa => 'ArrayRef' ); has links => ( is => 'rw' );
has menuLinks => ( is => 'rw', isa => 'ArrayRef' ); has menuLinks => ( is => 'rw' );
has logger => ( is => 'rw' ); has logger => ( is => 'rw' );
has userLogger => ( is => 'rw' ); has userLogger => ( is => 'rw' );
# INITIALIZATION # INITIALIZATION
......
package Lemonldap::NG::Common::PSGI::Cli::Lib; package Lemonldap::NG::Common::PSGI::Cli::Lib;
use JSON; use JSON;
use Mouse; use Moo;
use Lemonldap::NG::Common::PSGI; use Lemonldap::NG::Common::PSGI;
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
has iniFile => ( is => 'ro', isa => 'Str' ); has iniFile => ( is => 'ro' );
has app => ( is => 'ro', isa => 'CodeRef' ); has app => ( is => 'ro' );
sub _get { sub _get {
my ( $self, $path, $query ) = @_; my ( $self, $path, $query ) = @_;
......
...@@ -2,7 +2,7 @@ package Lemonldap::NG::Common::PSGI::Request; ...@@ -2,7 +2,7 @@ package Lemonldap::NG::Common::PSGI::Request;
use strict; use strict;
use 5.14.0; use 5.14.0;
use Mouse; use Moo;
use JSON; use JSON;
use Plack::Request; use Plack::Request;
use URI::Escape; use URI::Escape;
......
package Lemonldap::NG::Common::PSGI::Router; package Lemonldap::NG::Common::PSGI::Router;
use Mouse; use Moo;
use Lemonldap::NG::Common::PSGI; use Lemonldap::NG::Common::PSGI;
use Lemonldap::NG::Common::PSGI::Constants; use Lemonldap::NG::Common::PSGI::Constants;
...@@ -11,10 +11,9 @@ extends 'Lemonldap::NG::Common::PSGI'; ...@@ -11,10 +11,9 @@ extends 'Lemonldap::NG::Common::PSGI';
# Properties # Properties
has 'routes' => ( has 'routes' => (
is => 'rw', is => 'rw',
isa => 'HashRef',
default => sub { { GET => {}, POST => {}, PUT => {}, DELETE => {} } } default => sub { { GET => {}, POST => {}, PUT => {}, DELETE => {} } }
); );
has 'defaultRoute' => ( is => 'rw', default => 'index.html' ); has 'defaultRoute' => ( is => 'rw', default => sub{'index.html'} );
# Routes initialization # Routes initialization
......
...@@ -10,71 +10,36 @@ our $VERSION = '2.0.0'; ...@@ -10,71 +10,36 @@ our $VERSION = '2.0.0';