Insert more parameters in manager

This commit is contained in:
Xavier Guimard 2009-12-14 14:01:46 +00:00
parent 3b30a72d23
commit 4657e82a94
4 changed files with 110 additions and 19 deletions

View File

@ -805,7 +805,7 @@ sub hideCookie {
my $class = shift;
$class->lmLog( "$class: removing cookie", 'debug' );
my $tmp = lmHeaderIn( $apacheRequest, 'Cookie' );
$tmp =~ s/$cookieName[^,;]*[,;]?//o;
$tmp =~ s/$cookieName(?:http)?[^,;]*[,;]?//o;
lmSetHeaderIn( $apacheRequest, 'Cookie' => $tmp );
}

View File

@ -68,7 +68,6 @@ function none(id) {
}
function hashRoot(){
currentId=simpleTreeCollection[0].getSelected().attr('id');
alert(currentId);
display('default','Lemonldap::NG Manager');
$('#newkbr').css('display','block');
}

View File

@ -50,7 +50,8 @@ sub node {
# subnode points to a configuration node
elsif ( $flag =~ /^n?hash$/ ) {
$res .= $self->confNode( $node, "$flag:$target", $help, $_j );
$res .=
$self->confNode( $node, "$flag:$target", $help, $_j );
}
else {
@ -85,11 +86,13 @@ sub confNode {
return unless ($h);
foreach ( sort keys %$h ) {
if ( ref($h) ) {
$res .= $self->ajaxNode( "$target/$_", $_, "node=$node/$_\&key=$_",
$help, $js, undef, 1 );
$res .= $self->ajaxNode( "$target/$_", $_,
"node=$node/$_\&key=$_", $help, $js, undef, 1 );
}
else {
$res .= $self->confNode( "$target/$_", "btext:$target/$_", $help, $js );
$res .=
$self->confNode( "$target/$_", "btext:$target/$_", $help,
$js );
}
}
}
@ -109,7 +112,8 @@ sub confNode {
# Here, "notranslate" is set to true : hash values must not be
# translated
$res .= $self->li($id)
$res .=
$self->li($id)
. $self->span( $id, "$_", $h->{$_}, $js, $help, 1 ) . "</li>";
}
}
@ -124,19 +128,27 @@ sub confNode {
$h = $self->keyToH( $target, $self->defaultConf ) unless ( defined $h );
unless ( defined $h ) {
$self->lmLog( "$target does not exists in menu hash", "warn" );
return;
$self->lmLog( "$target does not exists in menu hash", "debug" );
$h = {
text => '',
hash => {},
'int' => 0,
}->{$type};
$self->lmLog( "Type $type unknown", 'warn' ) unless ( defined $h );
}
if ( ref($h) ) {
$res .= $self->li( "$target", "closed" )
$res .=
$self->li( "$target", "closed" )
. $self->span( "$target", $text, '', $js, $help ) . "<ul>";
foreach ( sort keys %$h ) {
if ( ref( $h->{$_} ) ) {
$res .= $self->confNode( '', "btext:$target/$_", $help, $js );
$res .=
$self->confNode( '', "btext:$target/$_", $help, $js );
}
else {
my $id = "$target/$_";
$res .= $self->li($id)
$res .=
$self->li($id)
. $self->span( $id, $_, $h->{$_}, $js, $help ) . "</li>";
}
}
@ -144,7 +156,8 @@ sub confNode {
}
else {
my $id = "$target";
$res .= $self->li($id)
$res .=
$self->li($id)
. $self->span( $id, $text, $h, $js, $help ) . "</li>";
}
}
@ -239,7 +252,8 @@ sub confObj {
sub ajaxNode {
my ( $self, $id, $text, $param, $help, $js, $data, $noT ) = @_;
$param .= "&amp;cfgNum=$self->{cfgNum}";
return $self->li($id)
return
$self->li($id)
. $self->span( $id, $text, $data, undef, $help, $noT )
. "<ul class=\"ajax\">"
. $self->li("sub_$id")
@ -259,7 +273,8 @@ sub span {
$id =~ s/(=*)$/length($1)/e;
$data =~ s/"/&#39;/g;
$tmp =~ s/"/&#39;/g;
$text = join ' ', map { $self->translate($_) } split /\s+/, $text unless($noT);
$text = join ' ', map { $self->translate($_) } split /\s+/, $text
unless ($noT);
$text = $self->escapeHTML($text);
return
"<span name=\"$tmp\" id=\"text_$id\" onclick=\"$js('$id')\" help=\"$help\" value=\"$data\">$text</span>

View File

@ -29,23 +29,33 @@ sub struct {
_help => 'default',
generalParameters => {
_nodes => [
qw(n:authParams cookieParams cn:exportedVars cn:macros sessionParams ldapParams)
qw(n:authParams cookieParams cn:exportedVars cn:macros sessionParams ldapParams n:advancedParams)
],
_help => 'default',
authParams => {
_nodes => [qw(portal authentication userDB whatToTrace)],
_nodes => [
qw(portal authentication userDB syslog whatToTrace singleSession singleIP singleUserByIP)
],
_help => 'authParams',
authentication => 'text:/authentication',
portal => 'text:/portal',
userDB => 'text:/userDB',
syslog => 'int:/syslog',
useXForwardedForIP => 'int:/useXForwardedForIP',
whatToTrace => 'text:/whatToTrace:whatToTrace:text',
singleSession => 'int:/singleSession',
singleIP => 'int:/singleIP',
singleUserByIP => 'int:/singleUserByIP',
},
cookieParams => {
_nodes => [qw(cookieName domain securedCookie)],
_nodes =>
[qw(cookieName domain securedCookie cookieExpiration)],
_help => 'cookies',
cookieName => 'text:/cookieName:cookieName:text',
domain => 'text:/domain:domain:text',
securedCookie =>
'int:/securedCookie:securedCookie:securedCookieValues',
cookieExpiration => 'text:/cookieExpiration',
},
exportedVars => {
_nodes => ['hash:/exportedVars:vars:btext'],
@ -76,8 +86,44 @@ sub struct {
managerDn => 'text:/managerDn',
managerPassword => 'text:/managerPassword',
},
advancedParams => {
_nodes => [
qw(Soap exportedAttr storePassword trustedDomains status https protection notifications passwordManagement)
],
Soap => 'int:/Soap',
https => 'int:/https',
exportedAttr => 'text:/exportedAttr',
storePassword => 'int:/storePassword',
notifications => {
_nodes => [
qw(notification notificationStorage notificationStorageOptions)
],
_help => 'notifications',
notification => 'int:/notification',
notificationStorage => 'text:/notificationStorage',
notificationStorageOptions => {
_nodes => ['hash:/notificationStorageOptions'],
_js => 'hashRoot'
},
},
passwordManagement => {
_nodes => [
qw(passwordDB SMTPServer mailFrom mailSubject randomPasswordRegexp mailBody)
],
passwordDB => 'text:/passwordDB',
SMTPServer => 'text:/SMTPServer',
mailFrom => 'text:/mailFrom',
mailSubject => 'text:/mailSubject',
randomPasswordRegexp => 'text:/randomPasswordRegexp',
mailBody => 'text:/mailBody',
},
trustedDomains => 'text:/trustedDomains',
status => 'int:/status',
protection => 'int:/protection',
}
},
groups => { _nodes => ['hash:/groups:groups:btext'], _js => 'hashRoot' },
groups =>
{ _nodes => ['hash:/groups:groups:btext'], _js => 'hashRoot' },
virtualHosts =>
{ _nodes => ['nhash:/locationRules:virtualHosts:none'], },
};
@ -92,6 +138,7 @@ sub testStruct {
return 1 if ( $@ =~ /Global symbol "\$.*requires explicit package/ );
return ( $@ ? ( 0, $@ ) : 1 );
};
my $boolean = { test => qr/^(?:0|1)?$/, msgFail => 'Value must be 0 or 1' };
return {
authentication => {
test => qr/^[a-zA-Z][\w\:]*$/,
@ -109,6 +156,7 @@ sub testStruct {
test => qr/^https?:\/\/\S+$/,
msgFail => 'Bad portal value',
},
cda => $boolean,
cookieName => {
test => qr/^[a-zA-Z]\w*$/,
msgFail => 'Bad cookie name',
@ -158,6 +206,14 @@ sub testStruct {
msgFail => 'Bad LDAP dn',
},
managerPassword => {},
notificationStorage => {
test => qr/^[\w:]+$/,
msgFail => 'Bad module name',
},
notificationStorageOptions => {
keyTest => qr/^\w+$/,
keyMsgFail => 'Bad parameter',
},
groups => {
keyTest => qr/^\w[\w-]*$/,
keyMsgFail => 'Bad group name',
@ -229,13 +285,34 @@ sub testStruct {
},
},
},
syslog => $boolean,
Soap => $boolean,
storePassword => $boolean,
notification => $boolean,
status => $boolean,
https => $boolean,
protection => {
keyTest => qr/^(?:none|authentificate|manager|)$/,
msgFail => 'must be one of none authentificate manager',
},
useXForwardedForIP => $boolean,
singleSession => $boolean,
singleIP => $boolean,
singleUserByIP => $boolean,
};
}
sub defaultConf {
return {
authentication => 'LDAP',
userDB => 'LDAP',
ldapServer => 'localhost',
globalStorage => 'Apache::Session::File',
globalStorageOptions => {
'Directory' => '/var/lib/lemonldap-ng/sessions/',
'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/'
},
timeout => 7200,
};
}