Add "over" feature to choice (#1500)
This commit is contained in:
parent
69737ab276
commit
1ef8c05908
|
@ -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'
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -32,11 +32,26 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4 trspan="overPrm"></h4>
|
||||
<table class="table">
|
||||
<tr ng-repeat="t in currentNode.data[5]">
|
||||
<td>
|
||||
<input class="form-control" ng-model="t[0]" />
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" ng-model="t[1]" />
|
||||
</td>
|
||||
<td>
|
||||
<span class="link text-danger glyphicon glyphicon-minus-sign" ng-click="del(currentNode.data.over,$index)"/>
|
||||
<span ng-if="$last" class="link text-success glyphicon glyphicon-plus-sign" ng-click="menuClick({title:'newCmbOver'})"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/menu">
|
||||
[{
|
||||
"action": "newAuthChoice",
|
||||
"title": "newChain",
|
||||
"action": "newChoiceOver",
|
||||
"title": "newCmbOver",
|
||||
"icon": "plus-sign"
|
||||
},{
|
||||
"title": "deleteEntry",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 1.10.0
|
||||
// Generated by CoffeeScript 1.12.8
|
||||
(function() {
|
||||
var filterFunctions;
|
||||
|
||||
|
@ -46,7 +46,9 @@
|
|||
ref3 = m.data;
|
||||
for (o = 0, len4 = ref3.length; o < len4; o++) {
|
||||
s = ref3[o];
|
||||
p(s);
|
||||
if (typeof s === 'string') {
|
||||
p(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
(function(){var a;a={authParams:function(e,c,g){var d,b,j,f,h;h=[];f=g.nodes;for(d=0,b=f.length;d<b;d++){j=f[d];h.push(e.getKey(j))}return c.all(h).then(function(){var i,N,M,K,z,y,x,v,u,t,J,n,w,I,H,G,F,D,C,B,A,L,E;i=false;n=[];H=function(l){var k;k=l.toLowerCase();if(k==="ad"){k="ldap"}else{if(k==="openidconnect"){k="oidc"}}return n.push(k+"Params")};D=g.nodes;for(N=0,z=D.length;N<z;N++){j=D[N];H(j.data)}C=g.nodes_cond;for(M=0,y=C.length;M<y;M++){j=C[M];L=0;w=j._nodes?j._nodes:j.nodes;if(g.nodes[0].data==="Choice"&&j.id==="choiceParams"){console.log("Choice is selected");if(w[1].cnodes){L++}else{w=w[1]._nodes?w[1]._nodes:w[1].nodes;for(K=0,x=w.length;K<x;K++){J=w[K];B=J.data;for(I=0,v=B.length;I<v;I++){E=B[I];H(E)}}}}else{if(g.nodes[0].data==="Combination"&&j.id==="combinationParams"){console.log("Combination is selected");if(w[1].cnodes){L++}else{w=w[1]._nodes?w[1]._nodes:w[1].nodes;for(G=0,u=w.length;G<u;G++){J=w[G];H(J.data.type)}}}}if(L){e.waiting=true;e.download({"$modelValue":w[1]}).then(function(){return a.authParams(e,c,g)});return}}A=g.nodes_cond;for(F=0,t=A.length;F<t;F++){j=A[F];if(!i&&n.indexOf(j.id)===-1){j.show=false}else{j.show=true}}})}};window.filterFunctions=a}).call(this);
|
||||
(function(){var filterFunctions;filterFunctions={authParams:function(scope,$q,node){var i,len,n,ref,wait;wait=[];ref=node.nodes;for(i=0,len=ref.length;i<len;i++){n=ref[i];wait.push(scope.getKey(n))}return $q.all(wait).then(function(){var all,j,k,l,len1,len2,len3,len4,len5,len6,m,nToShow,nd,o,p,q,r,ref1,ref2,ref3,ref4,restart,s;all=false;nToShow=[];p=function(s){var tmp;tmp=s.toLowerCase();if(tmp==="ad"){tmp="ldap"}else if(tmp==="openidconnect"){tmp="oidc"}return nToShow.push(tmp+"Params")};ref1=node.nodes;for(j=0,len1=ref1.length;j<len1;j++){n=ref1[j];p(n.data)}ref2=node.nodes_cond;for(k=0,len2=ref2.length;k<len2;k++){n=ref2[k];restart=0;nd=n._nodes?n._nodes:n.nodes;if(node.nodes[0].data==="Choice"&&n.id==="choiceParams"){console.log("Choice is selected");if(nd[1].cnodes){restart++}else{nd=nd[1]._nodes?nd[1]._nodes:nd[1].nodes;for(l=0,len3=nd.length;l<len3;l++){m=nd[l];ref3=m.data;for(o=0,len4=ref3.length;o<len4;o++){s=ref3[o];if(typeof s==="string"){p(s)}}}}}else if(node.nodes[0].data==="Combination"&&n.id==="combinationParams"){console.log("Combination is selected");if(nd[1].cnodes){restart++}else{nd=nd[1]._nodes?nd[1]._nodes:nd[1].nodes;for(q=0,len5=nd.length;q<len5;q++){m=nd[q];p(m.data.type)}}}if(restart){scope.waiting=true;scope.download({$modelValue:nd[1]}).then(function(){return filterFunctions.authParams(scope,$q,node)});return}}ref4=node.nodes_cond;for(r=0,len6=ref4.length;r<len6;r++){n=ref4[r];if(!all&&nToShow.indexOf(n.id)===-1){n.show=false}else{n.show=true}}})}};window.filterFunctions=filterFunctions}).call(this);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Generated by CoffeeScript 1.12.7
|
||||
// Generated by CoffeeScript 1.12.8
|
||||
|
||||
/*
|
||||
LemonLDAP::NG Manager client
|
||||
|
@ -371,6 +371,15 @@ This file contains:
|
|||
}
|
||||
return d.over.push(["new" + (id++), '']);
|
||||
};
|
||||
$scope.newChoiceOver = function() {
|
||||
var d;
|
||||
d = $scope.currentNode.data;
|
||||
console.log("data", d);
|
||||
if (!d[5]) {
|
||||
d[5] = [];
|
||||
}
|
||||
return d[5].push(["new" + (id++), '']);
|
||||
};
|
||||
$scope.addHost = function() {
|
||||
var cn;
|
||||
cn = $scope.currentNode;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,14 @@ sub init {
|
|||
'::'
|
||||
. [ 'Auth', 'UserDB', 'Password' ]->[$type] . '::'
|
||||
. $mods[$type];
|
||||
if ( $module = $self->loadModule($module) ) {
|
||||
my $over;
|
||||
if ( $mods[5] ) {
|
||||
eval { $over = from_json( $mods[5] ) };
|
||||
if ($@) {
|
||||
$self->logger->error("Bad over value ($@), skipped");
|
||||
}
|
||||
}
|
||||
if ( $module = $self->loadModule( $module, $over ) ) {
|
||||
$self->modules->{$name} = $module;
|
||||
$self->logger->debug(
|
||||
[qw(Authentication User Password)]->[$type]
|
||||
|
|
Loading…
Reference in New Issue
Block a user