From cf2bbb903245f68530bc204d32b997402f60cbf4 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 27 Feb 2013 11:01:07 +0000 Subject: [PATCH] add ldapgroup mapping UI part git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1450733 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/webapp/js/archiva/general-admin.js | 18 ++++++++++---- .../js/templates/archiva/general-admin.html | 24 ++++++++++++++----- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js index e63c42da1..c3da4b6f6 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js @@ -1698,6 +1698,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } self.modifiesLdapGroupMappings=ko.observableArray([]); } + this.modifiesLdapGroupMappings=ko.observableArray([]); this.modifyLdapGroupMapping=function(roleNames,ldapGroupMapping){ var toAdd=true; @@ -1711,6 +1712,13 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } $.log('modifyLdapGroupMapping:'+ldapGroupMapping.group()+','+self.modifiesLdapGroupMappings().length); }; + + addLdapGroupMapping=function(){ + $.log("addLdapGroupMapping"); + self.redbackRuntimeConfiguration().ldapGroupMappings.push(new LdapGroupMapping("",[],false,self.modifyLdapGroupMapping)); + $("#ldap-group-mappings-div select" ).select2({width: "element"}); + } + } ManagerImplementationInformation=function(beanId,descriptionKey,readOnly){ @@ -1806,9 +1814,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations,rbacManagerImplementationInformations); var groups=[]; - $.log("before useLdap"); - var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.userManagerImpls())>0 - ||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls())>0; + $.log("before useLdap:"+$.inArray("ldap",redbackRuntimeConfiguration.userManagerImpls()) + +','+$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls())); + var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.userManagerImpls())>=0 + ||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls())>=0; $.log("useLdap:"+useLdap); if(useLdap){ // load ldap roles @@ -1887,6 +1896,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } LdapGroupMapping=function(group,roleNames,automatic,subscribeFn){ + $.log("new LdapGroupMapping"); var self=this; this.modified=ko.observable(false); //private String group; @@ -1894,7 +1904,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" this.group.subscribe(function(newValue){ self.modified(true); if(subscribeFn){ - subscribeFn(newValue) + subscribeFn(newValue,self) } }); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html index 71cb94360..d9529948c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html @@ -1266,17 +1266,29 @@ {{each(i, ldapGroupMapping) ldapGroupMappings()}} - ${ldapGroupMapping.group()} + ${ldapGroupMapping.group()} + + -
- -
- + {{/each}} +
+ + + + + + + + +
+
+ -- 2.39.5