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; my $class = shift;
$class->lmLog( "$class: removing cookie", 'debug' ); $class->lmLog( "$class: removing cookie", 'debug' );
my $tmp = lmHeaderIn( $apacheRequest, 'Cookie' ); my $tmp = lmHeaderIn( $apacheRequest, 'Cookie' );
$tmp =~ s/$cookieName[^,;]*[,;]?//o; $tmp =~ s/$cookieName(?:http)?[^,;]*[,;]?//o;
lmSetHeaderIn( $apacheRequest, 'Cookie' => $tmp ); lmSetHeaderIn( $apacheRequest, 'Cookie' => $tmp );
} }

View File

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

View File

@ -50,7 +50,8 @@ sub node {
# subnode points to a configuration node # subnode points to a configuration node
elsif ( $flag =~ /^n?hash$/ ) { elsif ( $flag =~ /^n?hash$/ ) {
$res .= $self->confNode( $node, "$flag:$target", $help, $_j ); $res .=
$self->confNode( $node, "$flag:$target", $help, $_j );
} }
else { else {
@ -85,11 +86,13 @@ sub confNode {
return unless ($h); return unless ($h);
foreach ( sort keys %$h ) { foreach ( sort keys %$h ) {
if ( ref($h) ) { if ( ref($h) ) {
$res .= $self->ajaxNode( "$target/$_", $_, "node=$node/$_\&key=$_", $res .= $self->ajaxNode( "$target/$_", $_,
$help, $js, undef, 1 ); "node=$node/$_\&key=$_", $help, $js, undef, 1 );
} }
else { 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 # Here, "notranslate" is set to true : hash values must not be
# translated # translated
$res .= $self->li($id) $res .=
$self->li($id)
. $self->span( $id, "$_", $h->{$_}, $js, $help, 1 ) . "</li>"; . $self->span( $id, "$_", $h->{$_}, $js, $help, 1 ) . "</li>";
} }
} }
@ -124,19 +128,27 @@ sub confNode {
$h = $self->keyToH( $target, $self->defaultConf ) unless ( defined $h ); $h = $self->keyToH( $target, $self->defaultConf ) unless ( defined $h );
unless ( defined $h ) { unless ( defined $h ) {
$self->lmLog( "$target does not exists in menu hash", "warn" ); $self->lmLog( "$target does not exists in menu hash", "debug" );
return; $h = {
text => '',
hash => {},
'int' => 0,
}->{$type};
$self->lmLog( "Type $type unknown", 'warn' ) unless ( defined $h );
} }
if ( ref($h) ) { if ( ref($h) ) {
$res .= $self->li( "$target", "closed" ) $res .=
$self->li( "$target", "closed" )
. $self->span( "$target", $text, '', $js, $help ) . "<ul>"; . $self->span( "$target", $text, '', $js, $help ) . "<ul>";
foreach ( sort keys %$h ) { foreach ( sort keys %$h ) {
if ( ref( $h->{$_} ) ) { if ( ref( $h->{$_} ) ) {
$res .= $self->confNode( '', "btext:$target/$_", $help, $js ); $res .=
$self->confNode( '', "btext:$target/$_", $help, $js );
} }
else { else {
my $id = "$target/$_"; my $id = "$target/$_";
$res .= $self->li($id) $res .=
$self->li($id)
. $self->span( $id, $_, $h->{$_}, $js, $help ) . "</li>"; . $self->span( $id, $_, $h->{$_}, $js, $help ) . "</li>";
} }
} }
@ -144,7 +156,8 @@ sub confNode {
} }
else { else {
my $id = "$target"; my $id = "$target";
$res .= $self->li($id) $res .=
$self->li($id)
. $self->span( $id, $text, $h, $js, $help ) . "</li>"; . $self->span( $id, $text, $h, $js, $help ) . "</li>";
} }
} }
@ -239,7 +252,8 @@ sub confObj {
sub ajaxNode { sub ajaxNode {
my ( $self, $id, $text, $param, $help, $js, $data, $noT ) = @_; my ( $self, $id, $text, $param, $help, $js, $data, $noT ) = @_;
$param .= "&amp;cfgNum=$self->{cfgNum}"; $param .= "&amp;cfgNum=$self->{cfgNum}";
return $self->li($id) return
$self->li($id)
. $self->span( $id, $text, $data, undef, $help, $noT ) . $self->span( $id, $text, $data, undef, $help, $noT )
. "<ul class=\"ajax\">" . "<ul class=\"ajax\">"
. $self->li("sub_$id") . $self->li("sub_$id")
@ -259,7 +273,8 @@ sub span {
$id =~ s/(=*)$/length($1)/e; $id =~ s/(=*)$/length($1)/e;
$data =~ s/"/&#39;/g; $data =~ s/"/&#39;/g;
$tmp =~ 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); $text = $self->escapeHTML($text);
return return
"<span name=\"$tmp\" id=\"text_$id\" onclick=\"$js('$id')\" help=\"$help\" value=\"$data\">$text</span> "<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', _help => 'default',
generalParameters => { generalParameters => {
_nodes => [ _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', _help => 'default',
authParams => { authParams => {
_nodes => [qw(portal authentication userDB whatToTrace)], _nodes => [
qw(portal authentication userDB syslog whatToTrace singleSession singleIP singleUserByIP)
],
_help => 'authParams', _help => 'authParams',
authentication => 'text:/authentication', authentication => 'text:/authentication',
portal => 'text:/portal', portal => 'text:/portal',
userDB => 'text:/userDB', userDB => 'text:/userDB',
syslog => 'int:/syslog',
useXForwardedForIP => 'int:/useXForwardedForIP',
whatToTrace => 'text:/whatToTrace:whatToTrace:text', whatToTrace => 'text:/whatToTrace:whatToTrace:text',
singleSession => 'int:/singleSession',
singleIP => 'int:/singleIP',
singleUserByIP => 'int:/singleUserByIP',
}, },
cookieParams => { cookieParams => {
_nodes => [qw(cookieName domain securedCookie)], _nodes =>
[qw(cookieName domain securedCookie cookieExpiration)],
_help => 'cookies',
cookieName => 'text:/cookieName:cookieName:text', cookieName => 'text:/cookieName:cookieName:text',
domain => 'text:/domain:domain:text', domain => 'text:/domain:domain:text',
securedCookie => securedCookie =>
'int:/securedCookie:securedCookie:securedCookieValues', 'int:/securedCookie:securedCookie:securedCookieValues',
cookieExpiration => 'text:/cookieExpiration',
}, },
exportedVars => { exportedVars => {
_nodes => ['hash:/exportedVars:vars:btext'], _nodes => ['hash:/exportedVars:vars:btext'],
@ -76,8 +86,44 @@ sub struct {
managerDn => 'text:/managerDn', managerDn => 'text:/managerDn',
managerPassword => 'text:/managerPassword', 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 => virtualHosts =>
{ _nodes => ['nhash:/locationRules:virtualHosts:none'], }, { _nodes => ['nhash:/locationRules:virtualHosts:none'], },
}; };
@ -92,6 +138,7 @@ sub testStruct {
return 1 if ( $@ =~ /Global symbol "\$.*requires explicit package/ ); return 1 if ( $@ =~ /Global symbol "\$.*requires explicit package/ );
return ( $@ ? ( 0, $@ ) : 1 ); return ( $@ ? ( 0, $@ ) : 1 );
}; };
my $boolean = { test => qr/^(?:0|1)?$/, msgFail => 'Value must be 0 or 1' };
return { return {
authentication => { authentication => {
test => qr/^[a-zA-Z][\w\:]*$/, test => qr/^[a-zA-Z][\w\:]*$/,
@ -109,6 +156,7 @@ sub testStruct {
test => qr/^https?:\/\/\S+$/, test => qr/^https?:\/\/\S+$/,
msgFail => 'Bad portal value', msgFail => 'Bad portal value',
}, },
cda => $boolean,
cookieName => { cookieName => {
test => qr/^[a-zA-Z]\w*$/, test => qr/^[a-zA-Z]\w*$/,
msgFail => 'Bad cookie name', msgFail => 'Bad cookie name',
@ -158,6 +206,14 @@ sub testStruct {
msgFail => 'Bad LDAP dn', msgFail => 'Bad LDAP dn',
}, },
managerPassword => {}, managerPassword => {},
notificationStorage => {
test => qr/^[\w:]+$/,
msgFail => 'Bad module name',
},
notificationStorageOptions => {
keyTest => qr/^\w+$/,
keyMsgFail => 'Bad parameter',
},
groups => { groups => {
keyTest => qr/^\w[\w-]*$/, keyTest => qr/^\w[\w-]*$/,
keyMsgFail => 'Bad group name', 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 { sub defaultConf {
return { return {
authentication => 'LDAP',
userDB => 'LDAP', userDB => 'LDAP',
ldapServer => 'localhost', ldapServer => 'localhost',
globalStorage => 'Apache::Session::File',
globalStorageOptions => {
'Directory' => '/var/lib/lemonldap-ng/sessions/',
'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/'
},
timeout => 7200,
}; };
} }