diff --git a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm
index 2e427bf94..df55e96ca 100644
--- a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm
+++ b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm
@@ -102,7 +102,7 @@ sub unserialize {
# Manage hashes
if ( $k =~
-/^(?:exportedVars|locationRules|groups|exportedHeaders|macros|globalStorageOptions|remoteGlobalStorageOptions|notificationStorageOptions|samlIDPMetaDataXML|samlIDPMetaDataExportedAttributes|samlIDPMetaDataOptions|samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions|samlStorageOptions|CAS_proxiedServices|logoutServices|authChoiceModules|applicationList)$/
+/^(?:exportedVars|locationRules|groups|exportedHeaders|macros|globalStorageOptions|remoteGlobalStorageOptions|notificationStorageOptions|samlIDPMetaDataXML|samlIDPMetaDataExportedAttributes|samlIDPMetaDataOptions|samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions|samlStorageOptions|CAS_proxiedServices|logoutServices|authChoiceModules|applicationList|post)$/
and $v ||= {}
and not ref($v) )
{
diff --git a/modules/lemonldap-ng-manager/example/skins/default/manager.js b/modules/lemonldap-ng-manager/example/skins/default/manager.js
index de0c0d3c0..7b39224e2 100644
--- a/modules/lemonldap-ng-manager/example/skins/default/manager.js
+++ b/modules/lemonldap-ng-manager/example/skins/default/manager.js
@@ -152,23 +152,25 @@ function lmdata(id){
function lmparent(id){
return $('#'+id).parent().parent().attr('id');
}
-function setlmtext(id,v){
+function setlmtext(id,v,prefixvalue){
+ if(!prefixvalue){prefixvalue="";}
if(v.length==0){
alert("Null value");
}
else {
- $('#text_'+id).attr('name',v);
+ $('#text_'+id).attr('name',prefixvalue+v);
$('#text_'+id).text(v);
}
}
-function setlminputtext(id,input){
+function setlminputtext(id,input,prefixvalue){
var inputname=$(input).attr('id');
var inputvalue=$(input).attr('value');
+ if(!prefixvalue){prefixvalue="";}
if(inputvalue.length==0){
alert('No '+inputname);
return false;
}
- setlmtext(id,inputvalue);
+ setlmtext(id,inputvalue,prefixvalue);
}
function setlmdata(id,v){
$('#text_'+id).attr('value',escape(v));
@@ -288,6 +290,8 @@ function display(div,title) {
$('#newchoicer,#newchoice,#delchoice').hide();
$('#newcategoryr,#delcategory').hide();
$('#newapplicationr,#delapplication').hide();
+ $('#newpostr,#delpost').hide();
+ $('#newpostdatar,#delpostdata').hide();
var height_cur=$('#buttons').height()+$('#edition').height()+$('#help').height();
var height_max=$('#menu').height();
if(height_cur > height_max || $('#help_content').is(':visible')==false){
@@ -1084,3 +1088,55 @@ function applicationListApplication(id){
$('#delapplication').show();
}
+/* Post */
+function postRoot(id){
+ currentId=id;
+ display('default','');
+ $('#newpostr').show();
+}
+
+function newPostR(){
+ var newIdValue=newId(currentId);
+ var newPostKey = 'none';
+ simpleTreeCollection[0].addNode(newIdValue,newPostKey,function(d,s){
+ $('>span',s).attr('onClick','post("'+newIdValue+'")').attr('name',newPostKey).attr('value','').attr('id','text_'+newIdValue);
+ post(newIdValue);
+ });
+ return false;
+}
+
+function newPostDataR(){
+ var newIdValue=newId(currentId);
+ var newPostKey = 'login';
+ simpleTreeCollection[0].addNode(newIdValue,newPostKey,function(d,s){
+ $('>span',s).attr('onClick','postData("'+newIdValue+'")').attr('name','postdata:'+newPostKey).attr('value','$uid').attr('id','text_'+newIdValue);
+ postData(newIdValue);
+ });
+ return false;
+}
+
+function post(id){
+ currentId=id;
+ $('#postKey').attr('value',lmtext(id));
+ $('#postUrl').attr('value',lmdata(id));
+ display('post',lmtext(lmparent(id)));
+ $('#delpost,#newpostdatar').show();
+}
+
+function postData(id){
+ currentId=id;
+ var cleankey = lmtext(id).replace('postdata:','');
+ $('#postDataKey').attr('value',cleankey);
+ $('#postDataValue').attr('value',lmdata(id));
+ display('postdata',cleankey);
+ $('#delpostdata').show();
+}
+
+function delPost(){
+ delKey();
+}
+
+function delPostData(){
+ delKey();
+}
+
diff --git a/modules/lemonldap-ng-manager/example/skins/default/manager.tpl b/modules/lemonldap-ng-manager/example/skins/default/manager.tpl
index a3a45a535..e083f08da 100644
--- a/modules/lemonldap-ng-manager/example/skins/default/manager.tpl
+++ b/modules/lemonldap-ng-manager/example/skins/default/manager.tpl
@@ -165,6 +165,21 @@
+
+
+
+
+
+
+
@@ -518,6 +533,32 @@
+
+
+
+
+
+
+
+
+
diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm
index ebc411570..b1dab4199 100644
--- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm
+++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm
@@ -80,7 +80,7 @@ sub node {
}
# subnode points to a configuration node
- elsif ( $flag =~ /^(n?hash|applicationlist)$/ ) {
+ elsif ( $flag =~ /^(n?hash|applicationlist|post)$/ ) {
$res .=
$self->confNode( $node, "$flag:$target", $help, $_j );
}
@@ -261,8 +261,6 @@ sub confNode {
if ( %{ $h->{$catid} } ) {
$res .= '';
-
- # $res .= '-
';
}
foreach my $appid ( sort keys %{ $h->{$catid} } ) {
@@ -301,6 +299,81 @@ sub confNode {
}
}
+ # POST
+ elsif ( $target =~ s/^post:// ) {
+ $self->lmLog( "Load POST data (target $target)", 'debug' );
+
+ my $h = $self->keyToH( $target, $self->conf );
+
+ # Try to get value from defaultConf
+ unless ($h) {
+ unless ( $h = $self->subDefaultConf()->{post} ) {
+ $self->lmLog( "Try to get default conf for post", 'debug' );
+ $self->lmLog( "$target hash is not defined in configuration",
+ 'error' );
+ return;
+ }
+ }
+
+ # Loop on POST URI
+ foreach my $posturi ( sort keys %$h ) {
+
+ # Build ID
+ my $id = "$target/$posturi";
+ $id =~ s/=*$//;
+
+ # Display menu item
+ $self->lmLog( "Display menu item for POST URI $posturi", 'debug' );
+
+ # Here, "notranslate" is set to true : hashvalues must not be
+ # translated
+ $res .= $self->li($id)
+ . $self->span(
+ id => $id,
+ text => "$posturi",
+ data => $h->{$posturi}->{postUrl},
+ js => $js,
+ help => $help,
+ noT => 1
+ );
+
+ # Loop on post data (expr)
+
+ if ( %{ $h->{$posturi}->{expr} } ) {
+ $res .= '';
+ }
+
+ foreach my $postdata ( sort keys %{ $h->{$posturi}->{expr} } ) {
+
+ $id = "$target/$posturi/$postdata";
+ $id =~ s/=*$//;
+
+ # Display menu item
+ $self->lmLog( "Display menu item for POST data $postdata",
+ 'debug' );
+
+ $res .= $self->li($id)
+ . $self->span(
+ id => $id,
+ text => "$postdata",
+ name => "postdata:$postdata",
+ data => $h->{$posturi}->{expr}->{$postdata},
+ js => "postData",
+ help => $help,
+ noT => 1
+ ) . "";
+
+ }
+
+ if ( %{ $h->{$posturi}->{expr} } ) {
+ $res .= '
';
+ }
+
+ $res .= "";
+ }
+
+ }
+
else {
$target =~ s/^(\w+)://;
my $type = $1 || 'text';
@@ -568,7 +641,8 @@ sub span {
$args{js} .= "('$args{id}')" unless ( $args{js} =~ /\(/ );
# Text
- my $tmp = $args{text};
+ $args{name} ||= $args{text};
+ my $tmp = $args{name};
$tmp =~ s/"/'/g;
$args{text} = join ' ', map { $self->translate($_) } split /\s+/,
$args{text}
diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm
index a3aca1b00..12d6a81bf 100644
--- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm
+++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm
@@ -36,10 +36,12 @@ sub confUpload {
# - Virtual host name
# - SP and IDP name
# - Menu category ID
+ # - POST URL name
my $vhostname;
my $idpname;
my $spname;
my $catid;
+ my $postname;
# 1. ANALYSE DATAS
@@ -71,6 +73,10 @@ sub confUpload {
my $catflag = 0;
my $appflag = 0;
+ # For POST URL keys
+ my $postflag = 0;
+ my $postdataflag = 0;
+
# Unescape value
$value = uri_unescape($value);
@@ -118,6 +124,19 @@ sub confUpload {
}
}
+ # Get POST URL name
+ if ( $id =~ /post\/([^\/]*)?\/.*$/ ) {
+ if ( $name =~ s/^postdata:// ) {
+ $self->lmLog( "POST data $name", 'debug' );
+ $postdataflag = 1;
+ }
+ else {
+ $self->lmLog( "Entering POST URL $name", 'debug' );
+ $postflag = 1;
+ $postname = $name;
+ }
+ }
+
# Manage new keys
if ($NK) {
@@ -141,6 +160,9 @@ s/^virtualHosts\/([^\/]*)?\/header.*/exportedHeaders\/$1\/$name/;
$id =~
s/^virtualHosts\/([^\/]*)?\/rule.*/locationRules\/$1\/$name/;
+ # Virtual Host post
+ $id =~ s/^virtualHosts\/([^\/]*)?\/post.*/post\/$1\/$name/;
+
# SAML IDP attribute
$id =~
s/^samlIDPMetaDataExportedAttributes\/([^\/]*)?.*/samlIDPMetaDataExportedAttributes\/$1\/$name/;
@@ -166,7 +188,7 @@ s/^generalParameters\/authParams\/choiceParams\/([^\/]*)?.*/authChoiceModules\/$
# Set current Virtual Host name
$id =~
-s/^(exportedHeaders|locationRules)\/([^\/]*)?\/(.*)$/$1\/$vhostname\/$3/;
+s/^(exportedHeaders|locationRules|post)\/([^\/]*)?\/(.*)$/$1\/$vhostname\/$3/;
# Set current SAML IDP name
$id =~
@@ -176,6 +198,9 @@ s/^(samlIDPMetaDataXML|samlIDPMetaDataExportedAttributes|samlIDPMetaDataOptions)
$id =~
s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/([^\/]*)?\/(.*)$/$1\/$spname\/$3/;
+ # Set current POST URL name
+ $id =~ s/^(post)\/([^\/]*)?\/(.*)$/$1\/$vhostname\/$postname/;
+
$self->lmLog( "id transformed into $id", 'debug' );
if ( $id =~
@@ -279,6 +304,29 @@ s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/(
"application" );
}
+
+ # Post URL
+ elsif ($postflag) {
+ $self->lmLog( "Register POST URL $name data", 'debug' );
+
+ # Set postUrl
+ $self->setKeyToH(
+ $newConf, "post/$vhostname",
+ "$postname", { postUrl => $value }
+ ) if $value;
+ }
+
+ # Post data
+ elsif ($postdataflag) {
+ $self->lmLog( "Register POST data $name", 'debug' );
+
+ # Set post data in expr
+ $self->setKeyToH( $newConf, "post/$vhostname", "$postname",
+ { expr => { $name => $value } } )
+ if $value;
+ }
+
+ # Default case
else {
$self->setKeyToH(
$newConf, $confKey,
@@ -636,11 +684,42 @@ sub setKeyToH {
);
$tmp->{$key} = {};
}
+
+ # Value can be an hashref
+ if ( ref($value) eq 'HASH' ) {
+ foreach my $vv ( keys %$value ) {
+
+ # vv can be an hashref
+ if ( ref( $value->{$vv} ) eq 'HASH' ) {
+ foreach my $vvv ( keys %{ $value->{$vv} } ) {
+ $self->lmLog(
+ "setKeyToH: set "
+ . $value->{$vv}->{$vvv}
+ . " in key $vvv in key $vv in key $k2 inside key $key",
+ 'debug'
+ );
+ $tmp->{$key}->{$k2}->{$vv}->{$vvv} =
+ $value->{$vv}->{$vvv};
+ }
+ }
+ else {
+ $self->lmLog(
+ "setKeyToH: set "
+ . $value->{$vv}
+ . " in key $vv in key $k2 inside key $key",
+ 'debug'
+ );
+ $tmp->{$key}->{$k2}->{$vv} = $value->{$vv};
+ }
+ }
+ }
+ else {
$self->lmLog(
"setKeyToH: set $value in key $k2 inside key $key",
'debug' );
$tmp->{$key}->{$k2} = $value;
}
+ }
else {
$self->lmLog( "setKeyToH: set $value in key $key", 'debug' );
$tmp->{$key} = $value;
diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm
index 1aa1b86fe..4370e2839 100644
--- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm
+++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm
@@ -29,7 +29,7 @@ sub cstruct {
%$h,
virtualHosts => {
$k2 => {
- _nodes => [qw(rules:rules:rules headers)],
+ _nodes => [qw(rules:rules:rules headers post:post:post)],
rules => {
_nodes => ["hash:/locationRules/$k2:rules:rules"],
_js => 'rulesRoot'
@@ -38,6 +38,10 @@ sub cstruct {
_nodes => ["hash:/exportedHeaders/$k2"],
_js => 'hashRoot'
},
+ post => {
+ _nodes => ["post:/post/$k2:post:post"],
+ _js => 'postRoot'
+ },
}
}
);
@@ -759,7 +763,7 @@ sub struct {
#################
virtualHosts => {
_nodes => ['nhash:/locationRules:virtualHosts:vhost'],
- _upload => ['/exportedHeaders'],
+ _upload => [ '/exportedHeaders', '/post' ],
_help => 'virtualHosts',
_js => 'vhostRoot',
},
@@ -1305,6 +1309,11 @@ sub testStruct {
test => qr/\w+$/,
msgFail => 'Unvalid session field',
},
+ post => {
+ keyTest => Lemonldap::NG::Common::Regexp::HOSTNAME,
+ keyMsgFail => 'Bad virtual host name',
+ '*' => { keyTest => $pcre, },
+ },
protection => {
keyTest => qr/^(?:none|authentificate|manager|)$/,
msgFail => 'must be one of none authentificate manager',
@@ -1763,6 +1772,7 @@ sub subDefaultConf {
},
notificationStorageOptions =>
{ dirName => '/var/lib/lemonldap-ng/notifications', },
+ post => { none => { expr => {}, }, },
remoteGlobalStorageOptions => {
'proxy' => 'https://remote/index.pl/sessions',
'ns' => 'https://remote/Lemonldap/NG/Common/CGI/SOAPService',
diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm
index 23ef3d127..52973e028 100644
--- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm
+++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm
@@ -215,6 +215,7 @@ sub en {
portalRequireOldPassword => 'Require old password',
portalSkin => 'Skin',
portalUserAttr => 'User attribute',
+ post => 'Form replay',
proxyParams => 'Proxy parameters',
randomPasswordRegexp => 'Regexp for password generation',
redirection => 'Handler redirections',
@@ -573,6 +574,7 @@ sub fr {
portalRequireOldPassword => 'Ancien mot de passe requis',
portalSkin => 'Thème visuel',
portalUserAttr => "Attribut de l'utilisateur",
+ post => 'Rejeu de formulaires',
proxyParams => 'Paramètres Proxy',
randomPasswordRegexp =>
'Expression regulière pour la génération des mots de passe',