Commit d5bdcdcd authored by Xavier Guimard's avatar Xavier Guimard

LEMONLDAP::NG : display bug fix in manager. Version stable 0.8.0.7.

parent dfc4b52e
......@@ -16,7 +16,7 @@ use MIME::Base64;
our @ISA = qw(Lemonldap::NG::Manager::Base);
our $VERSION = '0.61';
our $VERSION = '0.63';
sub new {
my ( $class, $args ) = @_;
......@@ -229,7 +229,7 @@ sub buildTree {
}
}
if ( $config->{globalStorageOptions} ) {
if ( $config->{globalStorageOptions} and %{ $config->{globalStorageOptions} } ) {
$tree->{item}->{item}->{generalParameters}->{item}->{sessionStorage}->{item}->{globalStorageOptions}->{item} = {};
$globalStorageOptions =
$tree->{item}->{item}->{generalParameters}->{item}->{sessionStorage}->{item}->{globalStorageOptions}->{item};
......@@ -242,7 +242,7 @@ sub buildTree {
}
my $indice = 1;
if ( $config->{locationRules} ) {
if ( $config->{locationRules} and %{ $config->{locationRules} } ) {
$tree->{item}->{item}->{virtualHosts}->{item} = {};
my $virtualHost = $tree->{item}->{item}->{virtualHosts}->{item};
# TODO: split locationRules into 2 arrays
......@@ -268,14 +268,14 @@ sub buildTree {
}
}
}
if ( $config->{groups} ) {
if ( $config->{groups} and %{ $config->{groups} } ) {
$tree->{item}->{item}->{groups}->{item} = {};
my $groups = $tree->{item}->{item}->{groups}->{item};
while ( my ( $group, $expr ) = each( %{ $config->{groups} } ) ) {
$groups->{$group} = $self->xmlField( 'both', $expr, $group );
}
}
if ( $config->{macros} ) {
if ( $config->{macros} and %{ $config->{macros} } ) {
$tree->{item}->{item}->{generalParameters}->{item}->{macros}->{item} = {};
my $macros = $tree->{item}->{item}->{generalParameters}->{item}->{macros}->{item};
while ( my ( $macro, $expr ) = each( %{ $config->{macros} } ) ) {
......@@ -315,7 +315,7 @@ sub print_upload {
}
sub upload {
my $self = shift;
my $self = shift;
my $config = $self->tree2conf(@_);
return SYNTAX_ERROR unless( $self->checkConf($config) );
return $self->config->saveConf($config);
......
......@@ -5,7 +5,7 @@ use Storable qw(thaw freeze);
use MIME::Base64;
use Lemonldap::NG::Manager::Conf::Constants;
our $VERSION = 0.44;
our $VERSION = 0.45;
our @ISA;
sub new {
......@@ -68,14 +68,12 @@ sub getConf {
my $fields = $self->load( $args->{cfgNum}, $args->{fields} );
my $conf;
while ( my ( $k, $v ) = each(%$fields) ) {
my $tmp;
$v =~ s/^'(.*)'$/$1/m;
eval "\$tmp = thaw(decode_base64('$v'))";
if ( $@ or not($tmp) ) {
$conf->{$k} = $v;
if( $k =~ /^(?:exportedVars|locationRules|groups|exportedHeaders|macros|globalStorageOptions)$/ ) {
$conf->{$k} = thaw(decode_base64($v));
}
else {
$conf->{$k} = $tmp;
$conf->{$k} = $v;
}
}
return $conf;
......
......@@ -2,7 +2,7 @@ package Lemonldap::NG::Manager::Help;
use AutoLoader qw(AUTOLOAD);
use UNIVERSAL qw(can);
our $VERSION = '0.3';
our $VERSION = '0.31';
sub import {
my ($caller_package) = caller;
......@@ -56,7 +56,7 @@ evaluated one time in the authentication phase, and the result is stored in the
<p> The last rule is a Perl regular expression (PCRE) that means 'search the
word "group1" in the string "groups"'.</p>
<p> The \$groups string joins all the groups where the user matchs the
expression. The groups are separated by a space in the \$groups string.
expression. The groups are separated by a space in the \$groups string.</p>
EOT
}
......
......@@ -8,7 +8,7 @@ use AutoLoader qw(AUTOLOAD);
require Lemonldap::NG::Manager::_i18n;
use Lemonldap::NG::Manager::Conf::Constants;
our $VERSION = '0.24';
our $VERSION = '0.25';
# TODO: Delete buttons in headers and rules if 'read-only'
......@@ -126,10 +126,10 @@ function onNodeSelect(nodeId) {
switch(tree.getUserData(nodeId,"modif")) {
case 'text':
k='valeur';
v='<input value="'+nodeId+'" onChange="tree.setItemText('+"'"+nodeId+"'"+',this.value);tree.changeItemId('+"'"+nodeId+"'"+',this.value);">';
v='<input value="'+nodeId+'" onChange="tree.setItemText('+"'"+nodeId+"'"+',this.value.replace(/^([^a-z])/i,\\'z\$1\\'));tree.changeItemId('+"'"+nodeId+"'"+',this.value);">';
break;
case 'both':
k='<input value="'+tree.getItemText(nodeId)+'" onChange="tree.setItemText('+"'"+nodeId+"'"+',this.value)">';
k='<input value="'+tree.getItemText(nodeId)+'" onChange="tree.setItemText('+"'"+nodeId+"'"+',this.value.replace(/^([^a-z])/i,\\'z\$1\\'))">';
v='<textarea cols=40 rows=2 onChange="tree.setUserData('+"'"+nodeId+"'"+','+"'"+'value'+"'"+',this.value)">'+tree.getUserData(nodeId,'value')+'</textarea>';
//v='<input size=80 name="value" value="'+tree.getUserData(nodeId,'value')+'" onChange="tree.setUserData('+"'"+nodeId+"'"+','+"'"+'value'+"'"+',this.value)">';
break;
......@@ -341,13 +341,14 @@ function saveConf(){
function tree2txt(id){
var s=tree.getSubItems(id);
var c=s.split(',');
var c;
id = id.replace(/^[0-9]*_/,'');
var r='<'+id+"><text>"+ec(tree.getItemText(id))+"</text>\\n";
if((!s) || s=='' || c.length==0){
if((!s) || s==''){
r+= '<value>'+ec(tree.getUserData(id,'value'))+"</value>\\n";
}
else {
c=s.split(',');
for(var i=0;i<c.length;i++){
r+=tree2txt(c[i]);
}
......
......@@ -5,7 +5,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 10;
use Test::More tests => 11;
BEGIN { use_ok('Lemonldap::NG::Manager') }
#########################
......@@ -21,11 +21,9 @@ ok( $h = new Lemonldap::NG::Manager(
{
configStorage => {
type => 'File',
dirName => "/tmp/",
dirName => ".",
},
dhtmlXTreeImageLocation => "/imgs/",
applyConfFile => '__DIR__/manager/apply.conf',
jsFile => 'example/lemonldap-ng-manager.js',
}
));
......@@ -37,3 +35,106 @@ ok( $h->print_css() );
ok( $h->print_lmjs() );
ok( $h->print_help() );
ok( $h->buildTree() );
my $tmp = &xml;
ok( ref($h->tree2conf( \$tmp )) );
sub xml {
return << 'EOF';
<root><text>Configuration 9</text>
<generalParameters><text>Paramtres gnraux</text>
<authParams><text>Paramtres d'authentification</text>
<authentication><text>Type d'authentification</text>
<value>ldap</value>
</authentication>
<portal><text>Portail</text>
<value>http://auth.example.com/</value>
</portal>
<securedCookie><text>Cookie scuris (SSL)</text>
<value>0</value>
</securedCookie>
</authParams>
<cookieName><text>Nom du cookie</text>
<value>lemonldap</value>
</cookieName>
<domain><text>Domaine</text>
<value>example.com</value>
</domain>
<exportedVars><text>Attributs LDAP exporter</text>
<cn><text>cn</text>
<value>cn</value>
</cn>
<mail><text>mail</text>
<value>mail</value>
</mail>
<uid><text>uid</text>
<value>uid</value>
</uid>
</exportedVars>
<ldapParameters><text>Paramtres LDAP</text>
<ldapBase><text>Base de recherche LDAP</text>
<value>dc=gendarmerie,dc=defense,dc=gouv,dc=fr</value>
</ldapBase>
<ldapPort><text>Port du serveur LDAP</text>
<value>389</value>
</ldapPort>
<ldapServer><text>Serveur LDAP</text>
<value>localhost</value>
</ldapServer>
<managerDn><text>Compte de connexion LDAP</text>
<value> </value>
</managerDn>
<managerPassword><text>Mot de passe LDAP</text>
<value> </value>
</managerPassword>
</ldapParameters>
<macros><text>Macros</text>
<value>undefined</value>
</macros>
<sessionStorage><text>Stockage des sessions</text>
<globalStorage><text>Module Apache::Session</text>
<value>Apache::Session::File</value>
</globalStorage>
<globalStorageOptions><text>Paramtres du module Apache::Session</text>
<Directory><text>Directory</text>
<value>/tmp</value>
</Directory>
</globalStorageOptions>
</sessionStorage>
</generalParameters>
<groups><text>Groupes d'utilisateurs</text>
<t0><text></text>
<value>undefined</value>
</t0>
</groups>
<virtualHosts><text>Htes virtuels</text>
<auth.example.com><text>auth.example.com</text>
<exportedHeaders_4><text>En-ttes HTTP</text>
<h_5><text>Auth-User</text>
<value>$uid</value>
</h_5>
</exportedHeaders_4>
<locationRules_4><text>Rgles</text>
<r_4><text>default</text>
<value>accept</value>
</r_4>
</locationRules_4>
</auth.example.com>
<test.example.com><text>test.example.com</text>
<exportedHeaders_1><text>En-ttes HTTP</text>
<h_3><text>Auth-User</text>
<value>$uid</value>
</h_3>
</exportedHeaders_1>
<locationRules_1><text>Rgles</text>
<r_1><text>test=no</text>
<value>deny</value>
</r_1>
<r_2><text>default</text>
<value>accept</value>
</r_2>
</locationRules_1>
</test.example.com>
</virtualHosts>
</root>
EOF
}
......@@ -22,11 +22,9 @@ ok( $h = new Lemonldap::NG::Manager(
{
configStorage => {
type => 'File',
dirName => "/tmp/",
dirName => ".",
},
dhtmlXTreeImageLocation => "/imgs/",
applyConfFile => '__DIR__/manager/apply.conf',
jsFile => 'example/lemonldap-ng-manager.js',
}
));
......
......@@ -22,11 +22,9 @@ ok( $h = new Lemonldap::NG::Manager(
{
configStorage => {
type => 'File',
dirName => "/tmp/",
dirName => ".",
},
dhtmlXTreeImageLocation => "/imgs/",
applyConfFile => '__DIR__/manager/apply.conf',
jsFile => 'example/lemonldap-ng-manager.js',
}
));
......
......@@ -19,5 +19,6 @@ t/Lemonldap-NG-Portal-AuthCAS.t
t/Lemonldap-NG-Portal-AuthLA.t
t/Lemonldap-NG-Portal-AuthSSL.t
t/Lemonldap-NG-Portal-CDA.t
t/Lemonldap-NG-Portal-i18n.t
t/Lemonldap-NG-Portal-SharedConf.t
t/Lemonldap-NG-Portal-Simple.t
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