Commit 39c6713a authored by Xavier Guimard's avatar Xavier Guimard

Tidy

parent 6172c767
......@@ -20,4 +20,4 @@ describe('Lemonldap::NG', function() {
expect(browser.getCurrentUrl()).toMatch(new RegExp('^http://test1.example.com(:' + process.env.TESTWEBSERVERPORT + ')?'));
});
});
});
});
\ No newline at end of file
......@@ -15,4 +15,4 @@ describe('Lemonldap::NG handler', function() {
expect(browser.driver.findElement(by.id('v-Base64')).getText()).toEqual('YTpi');
});
});
});
});
\ No newline at end of file
......@@ -15,4 +15,4 @@ describe('Lemonldap::NG', function() {
expect(browser.getCurrentUrl()).toMatch(new RegExp('^http://test1.example.com(:' + process.env.TESTWEBSERVERPORT + ')?/index.pl\\?foo=1'));
});
});
});
});
\ No newline at end of file
......@@ -13,4 +13,4 @@ describe('Lemonldap::NG', function() {
expect(browser.getCurrentUrl()).toMatch(new RegExp('^http://auth.example.com(:' + process.env.TESTWEBSERVERPORT + ')?/\\?url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tOjE5ODc2Lw=='));
});
});
});
});
\ No newline at end of file
......@@ -186,4 +186,4 @@
"timeout": 72000,
"userDB": "Demo",
"whatToTrace": "_whatToTrace"
}
}
\ No newline at end of file
......@@ -20,13 +20,14 @@ sub new {
Lemonldap::NG::Handler::Main->checkConf($self);
# Get access control rule
my $rule = $self->{protection} || Lemonldap::NG::Handler::Main->localConfig->{protection};
my $rule = $self->{protection}
|| Lemonldap::NG::Handler::Main->localConfig->{protection};
$rule =~ s/^rule\s*:?\s*//;
return $self if ( $rule eq "none" );
$rule =
$rule eq "authenticate" ? "accept" : $rule eq "manager" ? "" : $rule;
my $request = {};
my $res = $self->run($rule);
my $res = $self->run($rule);
if ( $res == 403 ) {
$self->abort( 'Forbidden',
......
......@@ -50,7 +50,7 @@ sub logLevelInit {
$class->lmLog( "Undefined log level: $level", 'error' );
}
else {
$class->_logLevel( $class->logLevels->{$level || 'notice'} );
$class->_logLevel( $class->logLevels->{ $level || 'notice' } );
}
}
......
......@@ -71,7 +71,8 @@ sub build_jail {
);
$self->jail->share_from( __PACKAGE__, [ @t, '&encrypt' ] );
$self->jail->share_from( 'MIME::Base64', ['&encode_base64'] );
$self->jail->share_from( 'Lemonldap::NG::Handler::Main::SharedVariables', [ '$_v' ] );
$self->jail->share_from( 'Lemonldap::NG::Handler::Main::SharedVariables',
['$_v'] );
return $self->jail;
}
......
......@@ -68,7 +68,7 @@ sub handler {
my @convertedHdrs =
( 'Content-Length' => 0, Cookie => ( $req->cookies // '' ) );
my $i = 0;
while( my $k = shift @$hdrs ) {
while ( my $k = shift @$hdrs ) {
my $v = shift @$hdrs;
if ( $k =~ /^(?:Lm-Remote-User|Cookie)$/ ) {
push @convertedHdrs, $k, $v;
......
......@@ -58,7 +58,8 @@ sub _run {
}
else {
# Unset headers (handler adds a Location header)
$self->lmLog( "User not authenticated, Try in use, cancel redirection",
$self->lmLog(
"User not authenticated, Try in use, cancel redirection",
'debug' );
$req->respHeaders( [] );
$self->routes( $self->unAuthRoutes );
......
......@@ -47,25 +47,19 @@ sub run {
my $timeout = $localConfig->{'timeout'} || '0';
# Display found values in debug mode
$class->lmLog(
"zimbraPreAuthKey: $zimbraPreAuthKey", 'debug' );
$class->lmLog(
"zimbraAccountKey: $zimbraAccountKey", 'debug' );
$class->lmLog( "zimbraBy: $zimbraBy",
'debug' );
$class->lmLog( "zimbraUrl: $zimbraUrl",
'debug' );
$class->lmLog( "zimbraSsoUrl: $zimbraSsoUrl",
'debug' );
$class->lmLog( "timeout: $timeout", 'debug' );
$class->lmLog( "zimbraPreAuthKey: $zimbraPreAuthKey", 'debug' );
$class->lmLog( "zimbraAccountKey: $zimbraAccountKey", 'debug' );
$class->lmLog( "zimbraBy: $zimbraBy", 'debug' );
$class->lmLog( "zimbraUrl: $zimbraUrl", 'debug' );
$class->lmLog( "zimbraSsoUrl: $zimbraSsoUrl", 'debug' );
$class->lmLog( "timeout: $timeout", 'debug' );
# Return if we are not on a Zimbra SSO URI
return $class->OK unless ( $uri =~ $zimbraSsoUrl );
# Check mandatory parameters
unless ($zimbraPreAuthKey) {
$class->lmLog(
"No Zimbra preauth key configured", 'error' );
$class->lmLog( "No Zimbra preauth key configured", 'error' );
return $class->SERVER_ERROR;
}
......@@ -94,7 +88,8 @@ sub _buildZimbraPreAuthUrl {
my ( $class, $key, $url, $account, $by, $timeout ) = @_;
# Expiration time is calculated with _utime and timeout
my $expires = $timeout ? ( $class->datas->{_utime} + $timeout ) * 1000 : $timeout;
my $expires =
$timeout ? ( $class->datas->{_utime} + $timeout ) * 1000 : $timeout;
# Timestamp
my $timestamp = time() * 1000;
......@@ -111,8 +106,7 @@ sub _buildZimbraPreAuthUrl {
my $zimbra_url =
"$url?account=$account&by=$by&timestamp=$timestamp&expires=$expires&preauth=$computed_value";
$class->lmLog(
"Build Zimbra URL: $zimbra_url", 'debug' );
$class->lmLog( "Build Zimbra URL: $zimbra_url", 'debug' );
return $zimbra_url;
}
......
......@@ -16,8 +16,8 @@ BEGIN { use_ok('Lemonldap::NG::Handler::Main::Jail') }
ok(
my $jail = Lemonldap::NG::Handler::Main::Jail->new(
'jail' => undef,
'useSafeJail' => 1,
'jail' => undef,
'useSafeJail' => 1,
),
'new jail object'
);
......
......@@ -13,7 +13,7 @@ my $module;
sub init {
my $arg = shift;
if($arg) {
if ($arg) {
$module = $arg;
use_ok($module);
}
......@@ -27,7 +27,7 @@ sub client {
}
sub module {
if(my $arg = shift) {
if ( my $arg = shift ) {
$module = $arg;
}
return $module;
......
......@@ -369,7 +369,12 @@ $managerAttr}
printf STDERR $format, $self->reverseTreeFile;
open( F, ">", $self->reverseTreeFile ) or die($!);
$jsonEnc->pretty(0);
print F $jsonEnc->encode($self->reverseScan(Lemonldap::NG::Manager::Build::Tree::tree(),'',{}));
print F $jsonEnc->encode(
$self->reverseScan(
Lemonldap::NG::Manager::Build::Tree::tree(),
'', {}
)
);
close F;
print STDERR "done\n";
}
......@@ -564,11 +569,12 @@ sub scanLeaf1 {
sub reverseScan {
my ( $self, $tree, $path, $res ) = @_;
foreach my $elem ( @$tree ) {
foreach my $elem (@$tree) {
$elem =~ s/^\*//;
if ( ref($elem) eq 'HASH' ) {
foreach (qw(nodes nodes_cond group)) {
$self->reverseScan($elem->{$_}, "$path$elem->{title}/", $res) if($elem->{$_});
$self->reverseScan( $elem->{$_}, "$path$elem->{title}/", $res )
if ( $elem->{$_} );
}
}
else {
......
......@@ -117,7 +117,7 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
# SESSION MANAGEMENT
# Delete
# Delete
$scope.deleteSession = ->
$scope.waiting = true
$http['delete']("#{scriptname}sessions/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
......
......@@ -44,7 +44,8 @@ count(3);
displayTests('done');
# Delete notification
$res = &client->_del('notifications/done/dwho_Test_20150503_dwho_VGVzdA==.done');
$res =
&client->_del('notifications/done/dwho_Test_20150503_dwho_VGVzdA==.done');
$res = &client->jsonResponse( 'notifications/done', 'groupBy=substr(uid,1)' );
ok( $res->{result} == 1, 'Result = 1' );
ok( $res->{count} == 0, 'Count = 0' );
......
......@@ -33,7 +33,7 @@ sub init {
# Does nothing.
# @return Lemonldap::NG::Portal constant
sub authenticate {
my ($self,$req) = @_;
my ( $self, $req ) = @_;
return PE_BADCREDENTIALS unless ( $req->{user} eq $req->{password} );
......
......@@ -23,7 +23,7 @@ sub init {
# Read username and password from POST datas
# @return Lemonldap::NG::Portal constant
sub extractFormInfo {
my ($self,$req) = @_;
my ( $self, $req ) = @_;
# Init captcha
if ( $self->conf->{captcha_login_enabled} ) {
......
......@@ -66,8 +66,8 @@ sub new {
return 0;
}
}
$self->{portal} = $portal;
$self->{conf} = $conf;
$self->{portal} = $portal;
$self->{conf} = $conf;
# Setting default LDAP password storage encoding to utf-8
$self->{conf}->{ldapPwdEnc} ||= 'utf-8';
......
......@@ -20,7 +20,7 @@ has menuModules => (
->p->lmLog( "Evaluate condition $cond for module $_", 'debug' );
my $tmp =
$_[0]->{p}->HANDLER->tsv->{jail}->jail_reval("sub{return $cond}");
push @res, [$_, $tmp] if ($tmp);
push @res, [ $_, $tmp ] if ($tmp);
}
return \@res;
}
......
......@@ -23,17 +23,17 @@ sub enabledPlugins {
}
}
# Check if captcha is required
# TODO: verify if this list is OK
#foreach my $key (
# qw(captcha_login_enabled captcha_mail_enabled captcha_register_enabled))
#{
# if ( $self->conf->{$key} ) {
# $self->lmLog( 'Captcha enabled', 'debug' );
# push @res, '::Plugins::Captcha';
# last;
# }
#}
# Check if captcha is required
# TODO: verify if this list is OK
#foreach my $key (
# qw(captcha_login_enabled captcha_mail_enabled captcha_register_enabled))
#{
# if ( $self->conf->{$key} ) {
# $self->lmLog( 'Captcha enabled', 'debug' );
# push @res, '::Plugins::Captcha';
# last;
# }
#}
# Check if SOAP is enabled
# TODO: REST
......
......@@ -107,7 +107,7 @@ sub controlUrl {
sub checkLogout {
my ( $self, $req ) = @_;
if ( $req->param('logout') ) {
$req->steps([@{ $self->beforeLogout }, 'deleteSession' ] );
$req->steps( [ @{ $self->beforeLogout }, 'deleteSession' ] );
}
PE_OK;
}
......
......@@ -13,7 +13,7 @@ use Lemonldap::NG::Portal::_LibAccess;
use base qw(Lemonldap::NG::Portal::_LibAccess);
use Clone qw(clone);
our $VERSION = '2.0.0';
our $VERSION = '2.0.0';
our $catlevel = 0;
## @method void menuInit()
......
......@@ -1142,7 +1142,8 @@ sub _subProcess {
# status module with the result (portal error).
sub updateStatus {
my $self = shift;
my $p = $Lemonldap::NG::Handler::Main::SharedVariables::_tshv->{tsv}->{statusPipe};
my $p = $Lemonldap::NG::Handler::Main::SharedVariables::_tshv->{tsv}
->{statusPipe};
print $p ( $self->{user} ? $self->{user} : $self->ipAddr )
. " => $ENV{SERVER_NAME}$ENV{SCRIPT_NAME} "
. $self->{error} . "\n"
......@@ -2083,7 +2084,7 @@ sub setSessionInfo {
#@return Lemonldap::NG::Portal constant
sub setMacros {
my $self = shift;
$self->{sessionInfo}->{groups} = '';
$self->{sessionInfo}->{groups} = '';
$self->{sessionInfo}->{hGroups} = {};
foreach ( sort keys %{ $self->{macros} } ) {
$self->{sessionInfo}->{$_} =
......
......@@ -15,7 +15,7 @@ use Unicode::String qw(utf8);
use strict;
our @EXPORT = qw(ldap);
our $VERSION = '2.0.0';
our $VERSION = '2.0.0';
our $ppLoaded = 0;
BEGIN {
......@@ -118,10 +118,10 @@ sub bind {
# Reimplementation of Net::LDAP::unbind() to force call to disconnect()
# @return Net::LDAP::Message
sub unbind {
my $self = shift;
my $self = shift;
my $ldap_uri = $self->uri;
$self->{portal}->lmLog("Unbind and disconnect from $ldap_uri", 'debug');
$self->{portal}->lmLog( "Unbind and disconnect from $ldap_uri", 'debug' );
my $mesg = $self->SUPER::unbind();
$self->SUPER::disconnect();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment