diff --git a/lemonldap-ng-manager/site/coffee/manager.coffee b/lemonldap-ng-manager/site/coffee/manager.coffee index 05a1b88a7..ec83b23e7 100644 --- a/lemonldap-ng-manager/site/coffee/manager.coffee +++ b/lemonldap-ng-manager/site/coffee/manager.coffee @@ -678,9 +678,9 @@ llapp.controller 'TreeCtrl', [ else node.data = data.value # Cast int as int (remember that booleans are int for Perl) - if node.type and node.type.match /^(bool|trool|boolOrExpr)$/ - node.data = node.data.toString() - else if node.type and node.type.match /^int$/ + #if node.type and node.type.match /^(bool|trool|boolOrExpr)$/ + #node.data = node.data.toString() + if node.type and node.type.match /^int$/ node.data = parseInt(node.data, 10) # Split SAML types else if node.type and node.type.match(/^(saml(Service|Assertion)|blackWhiteList)$/) and not (typeof node.data == 'object') diff --git a/lemonldap-ng-manager/site/htdocs/static/forms/bool.html b/lemonldap-ng-manager/site/htdocs/static/forms/bool.html index 6b50b659f..cf234d6fc 100644 --- a/lemonldap-ng-manager/site/htdocs/static/forms/bool.html +++ b/lemonldap-ng-manager/site/htdocs/static/forms/bool.html @@ -5,11 +5,11 @@
diff --git a/lemonldap-ng-manager/site/htdocs/static/forms/boolOrExpr.html b/lemonldap-ng-manager/site/htdocs/static/forms/boolOrExpr.html index 15f0f0bfa..bf626ac5f 100644 --- a/lemonldap-ng-manager/site/htdocs/static/forms/boolOrExpr.html +++ b/lemonldap-ng-manager/site/htdocs/static/forms/boolOrExpr.html @@ -5,15 +5,15 @@
diff --git a/lemonldap-ng-manager/site/htdocs/static/forms/simpleInputContainer.html b/lemonldap-ng-manager/site/htdocs/static/forms/simpleInputContainer.html index 28f6f6073..894bd1d36 100644 --- a/lemonldap-ng-manager/site/htdocs/static/forms/simpleInputContainer.html +++ b/lemonldap-ng-manager/site/htdocs/static/forms/simpleInputContainer.html @@ -28,11 +28,11 @@
@@ -41,15 +41,15 @@
@@ -58,15 +58,15 @@
diff --git a/lemonldap-ng-manager/site/htdocs/static/forms/trool.html b/lemonldap-ng-manager/site/htdocs/static/forms/trool.html index acc8d8616..f05750ea5 100644 --- a/lemonldap-ng-manager/site/htdocs/static/forms/trool.html +++ b/lemonldap-ng-manager/site/htdocs/static/forms/trool.html @@ -5,15 +5,15 @@
diff --git a/lemonldap-ng-manager/site/htdocs/static/js/manager.js b/lemonldap-ng-manager/site/htdocs/static/js/manager.js index e36778a70..f81f023bc 100644 --- a/lemonldap-ng-manager/site/htdocs/static/js/manager.js +++ b/lemonldap-ng-manager/site/htdocs/static/js/manager.js @@ -823,9 +823,7 @@ This file contains: } else { node.data = data.value; } - if (node.type && node.type.match(/^(bool|trool|boolOrExpr)$/)) { - node.data = node.data.toString(); - } else if (node.type && node.type.match(/^int$/)) { + if (node.type && node.type.match(/^int$/)) { node.data = parseInt(node.data, 10); } else if (node.type && node.type.match(/^(saml(Service|Assertion)|blackWhiteList)$/) && !(typeof node.data === 'object')) { node.data = node.data.split(';'); diff --git a/lemonldap-ng-manager/site/htdocs/static/js/manager.min.js b/lemonldap-ng-manager/site/htdocs/static/js/manager.min.js index f402c7305..97941c3a1 100644 --- a/lemonldap-ng-manager/site/htdocs/static/js/manager.min.js +++ b/lemonldap-ng-manager/site/htdocs/static/js/manager.min.js @@ -1 +1 @@ -(function(){var llapp;llapp=angular.module("llngManager",["ui.tree","ui.bootstrap","llApp","ngCookies"]);llapp.controller("TreeCtrl",["$scope","$http","$location","$q","$uibModal","$translator","$cookies","$htmlParams",function($scope,$http,$location,$q,$uibModal,$translator,$cookies,$htmlParams){var _checkSaveResponse,_download,_getAll,_stoggle,c,id,pathEvent,readError,setDefault,setHelp;$scope.links=window.links;$scope.menu=$htmlParams.menu;$scope.menulinks=window.menulinks;$scope.staticPrefix=window.staticPrefix;$scope.formPrefix=window.formPrefix;$scope.availableLanguages=window.availableLanguages;$scope.waiting=true;$scope.showM=false;$scope.showT=false;$scope.form="home";$scope.currentCfg={};$scope.confPrefix=window.confPrefix;$scope.message={};$scope.result="";$scope.translateTitle=function(node){return $translator.translateField(node,"title")};$scope.translateP=$translator.translateP;$scope.translate=$translator.translate;$scope.helpUrl="start.html#configuration";$scope.setShowHelp=function(val){var d;if(val==null){val=!$scope.showH}$scope.showH=val;d=new Date(Date.now());d.setFullYear(d.getFullYear()+1);return $cookies.put("showhelp",val?"true":"false",{expires:d})};$scope.showH=$cookies.get("showhelp")==="false"?false:true;if($scope.showH==null){$scope.setShowHelp(true)}readError=function(response){var e,j;e=response.status;j=response.statusLine;$scope.waiting=false;if(e===403){$scope.message={title:"forbidden",message:"",items:[]}}else if(e===401){console.log("Authentication needed");$scope.message={title:"authenticationNeeded",message:"__waitOrF5__",items:[]}}else if(e===400){$scope.message={title:"badRequest",message:j,items:[]}}else if(e>0){$scope.message={title:"badRequest",message:j,items:[]}}else{$scope.message={title:"networkProblem",message:"",items:[]}}return $scope.showModal("message.html")};$scope.showModal=function(tpl,init){var d,modalInstance;modalInstance=$uibModal.open({templateUrl:tpl,controller:"ModalInstanceCtrl",size:"lg",resolve:{elem:function(){return function(s){return $scope[s]}},set:function(){return function(f,s){return $scope[f]=s}},init:function(){return init}}});d=$q.defer();modalInstance.result.then(function(msgok){$scope.message={title:"",message:"",items:[]};return d.resolve(msgok)},function(msgnok){$scope.message={title:"",message:"",items:[]};return d.reject(msgnok)});return d.promise};$scope.menuClick=function(button){if(button.popup){window.open(button.popup)}else{if(!button.action){button.action=button.title}switch(typeof button.action){case"function":button.action($scope.currentNode,$scope);break;case"string":$scope[button.action]();break;default:console.log(typeof button.action)}}return $scope.showM=false};$scope.home=function(){$scope.form="home";return $scope.showM=false};_checkSaveResponse=function(data){var m;$scope.message={title:"",message:"",items:[]};if(data.needConfirm){$scope.confirmNeeded=true}if(data.message){$scope.message.message=data.message}if(data.details){for(m in data.details){if(m!=="__changes__"){if(m==="__needConfirmation__"){$scope.message.items.unshift({message:m,items:data.details[m]})}else{$scope.message.items.push({message:m,items:data.details[m]})}}}}$scope.waiting=false;if(data.result===1){$location.path("/confs/");$scope.message.title="successfullySaved"}else{$scope.message.title="saveReport"}return $scope.showModal("message.html")};$scope.downloadConf=function(){return window.open($scope.confPrefix+$scope.currentCfg.cfgNum+"?full=1")};$scope.save=function(){$scope.showModal("save.html").then(function(){$scope.waiting=true;$scope.data.push({id:"cfgLog",title:"cfgLog",data:$scope.result?$scope.result:""});return $http.post(window.confPrefix+"?cfgNum="+$scope.currentCfg.cfgNum+($scope.forceSave?"&force=1":""),$scope.data).then(function(response){$scope.data.pop();return _checkSaveResponse(response.data)},function(response){readError(response);return $scope.data.pop()})},function(){return console.log("Saving canceled")});return $scope.showM=false};$scope.saveRawConf=function($fileContent){$scope.waiting=true;return $http.post(window.confPrefix+"/raw",$fileContent).then(function(response){return _checkSaveResponse(response.data)},readError)};$scope.restore=function(){$scope.currentNode=null;return $scope.form="restore"};$scope.cancel=function(){$scope.currentNode.data=null;return $scope.getKey($scope.currentNode)};id=1;$scope._findContainer=function(){return $scope._findScopeContainer().$modelValue};$scope._findScopeContainer=function(){var cs;cs=$scope.currentScope;while(!cs.$modelValue.type.match(/Container$/)){cs=cs.$parentNodeScope}return cs};$scope._findScopeByKey=function(k){var cs;cs=$scope.currentScope;while(!(cs.$modelValue.title===k)){cs=cs.$parentNodeScope}return cs};$scope.newGrantRule=function(){var l,n,node;node=$scope._findContainer();l=node.nodes.length;n=l>0?l-1:0;return node.nodes.push({id:node.id+"/n"+id++,title:"New rule",re:"Message",comment:"New rule",data:"1",type:"grant"})};$scope.newRule=function(){var l,n,node;node=$scope._findContainer();l=node.nodes.length;n=l>0?l-1:0;return node.nodes.splice(n,0,{id:node.id+"/n"+id++,title:"New rule",re:"^/new",comment:"New rule",data:"accept",type:"rule"})};$scope.newPost=function(){var node;node=$scope._findContainer();return node.nodes.push({id:node.id+"/n"+id++,title:"/absolute/path/to/form",data:{},type:"post"})};$scope.newPostVar=function(){if($scope.currentNode.data.vars==null){$scope.currentNode.data.vars=[]}return $scope.currentNode.data.vars.push(["var1","$uid"])};$scope.newAuthChoice=function(){var node;node=$scope._findContainer();node.nodes.push({id:node.id+"/n"+id++,title:"1_Key",data:["Null","Null","Null"],type:"authChoice"});return $scope.execFilters($scope._findScopeByKey("authParams"))};$scope.newHashEntry=function(){var node;node=$scope._findContainer();return node.nodes.push({id:node.id+"/n"+id++,title:"new",data:"",type:"keyText"})};$scope.newCat=function(){var cs;cs=$scope.currentScope;if(cs.$modelValue.type==="menuApp"){cs=cs.$parentNodeScope}return cs.$modelValue.nodes.push({id:cs.$modelValue.id+"/n"+id++,title:"New category",type:"menuCat",nodes:[]})};$scope.newApp=function(){var cs;cs=$scope.currentScope;if(cs.$modelValue.type==="menuApp"){cs=cs.$parentNodeScope}return cs.$modelValue.nodes.push({id:cs.$modelValue.id+"/n"+id++,title:"New application",type:"menuApp",data:{description:"New app description",uri:"https://test.example.com/",logo:"network.png",display:"auto"}})};$scope.newCmbMod=function(){var node;node=$scope._findContainer();node.nodes.push({id:node.id+"/n"+id++,title:"new",type:"cmbModule",data:{type:"LDAP",for:"0",over:[]}});return $scope.execFilters($scope._findScopeByKey("authParams"))};$scope.newCmbOver=function(){var d;d=$scope.currentNode.data;if(!d.over){d.over=[]}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;if(!cn.data){cn.data=[]}return cn.data.push({k:"newHost",h:[{k:"key",v:"uid"}]})};$scope.addSamlAttribute=function(){var node;node=$scope._findContainer();return node.nodes.push({id:node.id+"/n"+id++,title:"new",type:"samlAttribute",data:["0","New","",""]})};$scope.addVhost=function(){var name;name=$scope.domain?"."+$scope.domain.data:".example.com";$scope.message={title:"virtualHostName",field:"hostname"};return $scope.showModal("prompt.html",name).then(function(){var n;n=$scope.result;if(n){return $scope.addTemplateNode(n,"virtualHost")}})};$scope.duplicateVhost=function(){var name;name=$scope.domain?"."+$scope.domain.data:".example.com";$scope.message={title:"virtualHostName",field:"hostname"};return $scope.showModal("prompt.html",name).then(function(){var n;n=$scope.result;return $scope.duplicateNode(n,"virtualHost",$scope.currentNode.title)})};$scope.addSamlIDP=function(){return $scope.newTemplateNode("samlIDPMetaDataNode","samlPartnerName","idp-example")};$scope.addSamlSP=function(){return $scope.newTemplateNode("samlSPMetaDataNode","samlPartnerName","sp-example")};$scope.addOidcOp=function(){return $scope.newTemplateNode("oidcOPMetaDataNode","oidcOPName","op-example")};$scope.addOidcRp=function(){return $scope.newTemplateNode("oidcRPMetaDataNode","oidcRPName","rp-example")};$scope.addCasSrv=function(){return $scope.newTemplateNode("casSrvMetaDataNode","casPartnerName","srv-example")};$scope.addCasApp=function(){return $scope.newTemplateNode("casAppMetaDataNode","casPartnerName","app-example")};$scope.newTemplateNode=function(type,title,init){$scope.message={title:title,field:"name"};return $scope.showModal("prompt.html",init).then(function(){var name;name=$scope.result;if(name){return $scope.addTemplateNode(name,type)}})};$scope.addTemplateNode=function(name,type){var cs,t;cs=$scope.currentScope;while(cs.$modelValue.title!==type+"s"){cs=cs.$parentNodeScope}t={id:type+"s/new__"+name,title:name,type:type,nodes:templates(type,"new__"+name)};setDefault(t.nodes);cs.$modelValue.nodes.push(t);cs.expand();return t};setDefault=function(node){var len,n,o;for(o=0,len=node.length;o0){tmp=p.nodes[ind];p.nodes[ind]=p.nodes[ind-1];p.nodes[ind-1]=tmp}return ind};$scope.inSelect=function(value){var len,n,o,ref;ref=$scope.currentNode.select;for(o=0,len=ref.length;o0?node.comment:node.re};$scope.filters={};$scope.execFilters=function(scope){var filter,func,ref;scope=scope?scope:$scope;ref=$scope.filters;for(filter in ref){func=ref[filter];if($scope.filters.hasOwnProperty(filter)){return window.filterFunctions[filter](scope,$q,func)}}return false};$scope.stoggle=function(scope){var node;node=scope.$modelValue;_stoggle(node);return scope.toggle()};_stoggle=function(node){var a,len,len1,len2,n,o,q,r,ref,ref1,ref2;ref=["nodes","nodes_cond"];for(o=0,len=ref.length;o0){$scope.message={title:"badRequest",message:j,items:[]}}else{$scope.message={title:"networkProblem",message:"",items:[]}}return $scope.showModal("message.html")};$scope.showModal=function(tpl,init){var d,modalInstance;modalInstance=$uibModal.open({templateUrl:tpl,controller:"ModalInstanceCtrl",size:"lg",resolve:{elem:function(){return function(s){return $scope[s]}},set:function(){return function(f,s){return $scope[f]=s}},init:function(){return init}}});d=$q.defer();modalInstance.result.then(function(msgok){$scope.message={title:"",message:"",items:[]};return d.resolve(msgok)},function(msgnok){$scope.message={title:"",message:"",items:[]};return d.reject(msgnok)});return d.promise};$scope.menuClick=function(button){if(button.popup){window.open(button.popup)}else{if(!button.action){button.action=button.title}switch(typeof button.action){case"function":button.action($scope.currentNode,$scope);break;case"string":$scope[button.action]();break;default:console.log(typeof button.action)}}return $scope.showM=false};$scope.home=function(){$scope.form="home";return $scope.showM=false};_checkSaveResponse=function(data){var m;$scope.message={title:"",message:"",items:[]};if(data.needConfirm){$scope.confirmNeeded=true}if(data.message){$scope.message.message=data.message}if(data.details){for(m in data.details){if(m!=="__changes__"){if(m==="__needConfirmation__"){$scope.message.items.unshift({message:m,items:data.details[m]})}else{$scope.message.items.push({message:m,items:data.details[m]})}}}}$scope.waiting=false;if(data.result===1){$location.path("/confs/");$scope.message.title="successfullySaved"}else{$scope.message.title="saveReport"}return $scope.showModal("message.html")};$scope.downloadConf=function(){return window.open($scope.confPrefix+$scope.currentCfg.cfgNum+"?full=1")};$scope.save=function(){$scope.showModal("save.html").then(function(){$scope.waiting=true;$scope.data.push({id:"cfgLog",title:"cfgLog",data:$scope.result?$scope.result:""});return $http.post(window.confPrefix+"?cfgNum="+$scope.currentCfg.cfgNum+($scope.forceSave?"&force=1":""),$scope.data).then(function(response){$scope.data.pop();return _checkSaveResponse(response.data)},function(response){readError(response);return $scope.data.pop()})},function(){return console.log("Saving canceled")});return $scope.showM=false};$scope.saveRawConf=function($fileContent){$scope.waiting=true;return $http.post(window.confPrefix+"/raw",$fileContent).then(function(response){return _checkSaveResponse(response.data)},readError)};$scope.restore=function(){$scope.currentNode=null;return $scope.form="restore"};$scope.cancel=function(){$scope.currentNode.data=null;return $scope.getKey($scope.currentNode)};id=1;$scope._findContainer=function(){return $scope._findScopeContainer().$modelValue};$scope._findScopeContainer=function(){var cs;cs=$scope.currentScope;while(!cs.$modelValue.type.match(/Container$/)){cs=cs.$parentNodeScope}return cs};$scope._findScopeByKey=function(k){var cs;cs=$scope.currentScope;while(!(cs.$modelValue.title===k)){cs=cs.$parentNodeScope}return cs};$scope.newGrantRule=function(){var l,n,node;node=$scope._findContainer();l=node.nodes.length;n=l>0?l-1:0;return node.nodes.push({id:node.id+"/n"+id++,title:"New rule",re:"Message",comment:"New rule",data:"1",type:"grant"})};$scope.newRule=function(){var l,n,node;node=$scope._findContainer();l=node.nodes.length;n=l>0?l-1:0;return node.nodes.splice(n,0,{id:node.id+"/n"+id++,title:"New rule",re:"^/new",comment:"New rule",data:"accept",type:"rule"})};$scope.newPost=function(){var node;node=$scope._findContainer();return node.nodes.push({id:node.id+"/n"+id++,title:"/absolute/path/to/form",data:{},type:"post"})};$scope.newPostVar=function(){if($scope.currentNode.data.vars==null){$scope.currentNode.data.vars=[]}return $scope.currentNode.data.vars.push(["var1","$uid"])};$scope.newAuthChoice=function(){var node;node=$scope._findContainer();node.nodes.push({id:node.id+"/n"+id++,title:"1_Key",data:["Null","Null","Null"],type:"authChoice"});return $scope.execFilters($scope._findScopeByKey("authParams"))};$scope.newHashEntry=function(){var node;node=$scope._findContainer();return node.nodes.push({id:node.id+"/n"+id++,title:"new",data:"",type:"keyText"})};$scope.newCat=function(){var cs;cs=$scope.currentScope;if(cs.$modelValue.type==="menuApp"){cs=cs.$parentNodeScope}return cs.$modelValue.nodes.push({id:cs.$modelValue.id+"/n"+id++,title:"New category",type:"menuCat",nodes:[]})};$scope.newApp=function(){var cs;cs=$scope.currentScope;if(cs.$modelValue.type==="menuApp"){cs=cs.$parentNodeScope}return cs.$modelValue.nodes.push({id:cs.$modelValue.id+"/n"+id++,title:"New application",type:"menuApp",data:{description:"New app description",uri:"https://test.example.com/",logo:"network.png",display:"auto"}})};$scope.newCmbMod=function(){var node;node=$scope._findContainer();node.nodes.push({id:node.id+"/n"+id++,title:"new",type:"cmbModule",data:{type:"LDAP",for:"0",over:[]}});return $scope.execFilters($scope._findScopeByKey("authParams"))};$scope.newCmbOver=function(){var d;d=$scope.currentNode.data;if(!d.over){d.over=[]}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;if(!cn.data){cn.data=[]}return cn.data.push({k:"newHost",h:[{k:"key",v:"uid"}]})};$scope.addSamlAttribute=function(){var node;node=$scope._findContainer();return node.nodes.push({id:node.id+"/n"+id++,title:"new",type:"samlAttribute",data:["0","New","",""]})};$scope.addVhost=function(){var name;name=$scope.domain?"."+$scope.domain.data:".example.com";$scope.message={title:"virtualHostName",field:"hostname"};return $scope.showModal("prompt.html",name).then(function(){var n;n=$scope.result;if(n){return $scope.addTemplateNode(n,"virtualHost")}})};$scope.duplicateVhost=function(){var name;name=$scope.domain?"."+$scope.domain.data:".example.com";$scope.message={title:"virtualHostName",field:"hostname"};return $scope.showModal("prompt.html",name).then(function(){var n;n=$scope.result;return $scope.duplicateNode(n,"virtualHost",$scope.currentNode.title)})};$scope.addSamlIDP=function(){return $scope.newTemplateNode("samlIDPMetaDataNode","samlPartnerName","idp-example")};$scope.addSamlSP=function(){return $scope.newTemplateNode("samlSPMetaDataNode","samlPartnerName","sp-example")};$scope.addOidcOp=function(){return $scope.newTemplateNode("oidcOPMetaDataNode","oidcOPName","op-example")};$scope.addOidcRp=function(){return $scope.newTemplateNode("oidcRPMetaDataNode","oidcRPName","rp-example")};$scope.addCasSrv=function(){return $scope.newTemplateNode("casSrvMetaDataNode","casPartnerName","srv-example")};$scope.addCasApp=function(){return $scope.newTemplateNode("casAppMetaDataNode","casPartnerName","app-example")};$scope.newTemplateNode=function(type,title,init){$scope.message={title:title,field:"name"};return $scope.showModal("prompt.html",init).then(function(){var name;name=$scope.result;if(name){return $scope.addTemplateNode(name,type)}})};$scope.addTemplateNode=function(name,type){var cs,t;cs=$scope.currentScope;while(cs.$modelValue.title!==type+"s"){cs=cs.$parentNodeScope}t={id:type+"s/new__"+name,title:name,type:type,nodes:templates(type,"new__"+name)};setDefault(t.nodes);cs.$modelValue.nodes.push(t);cs.expand();return t};setDefault=function(node){var len,n,o;for(o=0,len=node.length;o0){tmp=p.nodes[ind];p.nodes[ind]=p.nodes[ind-1];p.nodes[ind-1]=tmp}return ind};$scope.inSelect=function(value){var len,n,o,ref;ref=$scope.currentNode.select;for(o=0,len=ref.length;o0?node.comment:node.re};$scope.filters={};$scope.execFilters=function(scope){var filter,func,ref;scope=scope?scope:$scope;ref=$scope.filters;for(filter in ref){func=ref[filter];if($scope.filters.hasOwnProperty(filter)){return window.filterFunctions[filter](scope,$q,func)}}return false};$scope.stoggle=function(scope){var node;node=scope.$modelValue;_stoggle(node);return scope.toggle()};_stoggle=function(node){var a,len,len1,len2,n,o,q,r,ref,ref1,ref2;ref=["nodes","nodes_cond"];for(o=0,len=ref.length;o