diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm index 5cff184b6..ba046da11 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RESTServer.pm @@ -1,6 +1,7 @@ package Lemonldap::NG::Common::Conf::RESTServer; use strict; +use JSON 'from_json'; use Mouse; use Lemonldap::NG::Common::Conf::Constants; use Lemonldap::NG::Common::Conf::ReConstants; @@ -539,11 +540,16 @@ sub authChoiceModules { unless ($key) { my @res; foreach my $k ( sort keys %$value ) { + my $data = [ split /;/, $value->{$k} ]; + eval {$data->[5] = from_json($data->[5]) if $data->[5] }; + if($@){ + $self->logger->error("Bad value in choice over parameters, deleted ($@)"); + } push @res, { id => "authChoiceModules/$k", title => "$k", - data => [ split /;/, $value->{$k} ], + data => $data, type => 'authChoice' }; } diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm index 566a1f858..79e5ab1b3 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm @@ -21,6 +21,7 @@ package Lemonldap::NG::Manager::Conf::Parser; use strict; use utf8; use Mouse; +use JSON 'to_json'; use Lemonldap::NG::Common::Conf::ReConstants; use Lemonldap::NG::Manager::Attributes; @@ -762,6 +763,13 @@ sub _scanNodes { foreach my $n (@$subNodes) { hdebug(" looking at $n subnode"); if ( ref $n->{data} and ref $n->{data} eq 'ARRAY' ) { + # authChoiceModules + if ( $name eq 'authChoiceModules' ) { + hdebug(' combModules'); + $n->{data}->[5] ||= {}; + $n->{data}->[5] = to_json($n->{data}->[5]); + } + $n->{data} = join ';', @{ $n->{data} }; } $self->newConf->{$name}->{ $n->{title} } = $n->{data}; diff --git a/lemonldap-ng-manager/site/coffee/filterFunctions.coffee b/lemonldap-ng-manager/site/coffee/filterFunctions.coffee index 045b30555..0f07fa349 100644 --- a/lemonldap-ng-manager/site/coffee/filterFunctions.coffee +++ b/lemonldap-ng-manager/site/coffee/filterFunctions.coffee @@ -45,7 +45,7 @@ filterFunctions = nd = if nd[1]._nodes then nd[1]._nodes else nd[1].nodes for m in nd for s in m.data - p s + p s if typeof s == 'string' # Case "Combination" else if node.nodes[0].data == 'Combination' and n.id == 'combinationParams' diff --git a/lemonldap-ng-manager/site/coffee/manager.coffee b/lemonldap-ng-manager/site/coffee/manager.coffee index fc6bd5b98..ccd4c641d 100644 --- a/lemonldap-ng-manager/site/coffee/manager.coffee +++ b/lemonldap-ng-manager/site/coffee/manager.coffee @@ -316,6 +316,12 @@ llapp.controller 'TreeCtrl', [ d.over = [] unless d.over d.over.push ["new#{id++}", ''] + $scope.newChoiceOver = -> + d = $scope.currentNode.data + console.log "data", d + d[5] = [] unless d[5] + d[5].push ["new#{id++}", ''] + # Add host $scope.addHost = () -> cn = $scope.currentNode diff --git a/lemonldap-ng-manager/site/htdocs/static/forms/authChoice.html b/lemonldap-ng-manager/site/htdocs/static/forms/authChoice.html index 126aaca9a..60b229b9f 100644 --- a/lemonldap-ng-manager/site/htdocs/static/forms/authChoice.html +++ b/lemonldap-ng-manager/site/htdocs/static/forms/authChoice.html @@ -32,11 +32,26 @@ +

+ + + + + + +
+ + + + + + +