From 4f75fa5daaf30c60dfcf503e863cd105336b7f97 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 15 Feb 2013 14:14:19 +0000 Subject: [PATCH] [MRM-1736] map roles to ldap groups ui part. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1446589 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/webapp/js/archiva/general-admin.js | 100 +++++++++++++----- .../js/templates/archiva/general-admin.html | 4 +- 2 files changed, 74 insertions(+), 30 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 391b29bc8..e27f4857e 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 @@ -1257,7 +1257,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" this.ldapGroups.subscribe(function(newValue){self.modified(true)}); this.ldapGroupMappings=ko.observableArray([]); - this.ldapGroupMappings.subscribe(function(newValue){self.modified(true);}); + this.ldapGroupMappings.subscribe(function(newValue){ + self.modified(true); + $.log('ldapGroupMappings modified:'+newValue.group); + }); } @@ -1279,13 +1282,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" if (!$.isArray(configurationPropertiesEntries)){ configurationPropertiesEntries=[]; - } else { - configurationPropertiesEntries = $.each(configurationPropertiesEntries,function(item){ - $.log("each configurationPropertiesEntries"); - $.log("key:"+item); - return item; - }); } + redbackRuntimeConfiguration.configurationPropertiesEntries(configurationPropertiesEntries); redbackRuntimeConfiguration.modified(false); return redbackRuntimeConfiguration; @@ -1388,11 +1386,29 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" rowText: "value" } ], - pageSize: 10,//self.redbackRuntimeConfiguration().configurationPropertiesEntries.length, + pageSize: 10, gridUpdateCallBack: function(){ activatePopoverDoc(); } - }); + }); + + self.ldapGroupMappingsViewModel=new ko.simpleGrid.viewModel({ + data: self.redbackRuntimeConfiguration().ldapGroupMappings, + columns: [ + { + headerText: $.i18n.prop('redback.runtime.ldap.mapping.group.label'), + rowText: "group" + }, + { + headerText: $.i18n.prop('redback.runtime.ldap.mapping.roles.label'), + rowText: "value" + } + ], + pageSize: 10, + gridUpdateCallBack: function(){ + activatePopoverDoc(); + } + }); findUserManagerImplementationInformation=function(id){ for(var i= 0;i roleNames; this.roleNames=ko.observableArray(roleNames); - this.roleNames.subscribe(function(newValue){self.modified(true)}); + this.roleNames.subscribe(function(newValue){ + self.modified(true); + $.log("roleNames modified"); + if(subscribeFn){ + subscribeFn(newValue) + } + }); + + this.automatic=automatic?automatic:false; } - mapLdapGroupMappings=function(data){ + mapLdapGroupMappings=function(data,modifyLdapGroupMapping){ if(data!=null){ return $.map(data,function(item){ - return new LdapGroupMapping(item.group,item.roleNames?item.roleNames:[]); + return new LdapGroupMapping(item.group,item.roleNames?item.roleNames:[],false,modifyLdapGroupMapping); }) } return []; 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 56be27cc1..20d067185 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 @@ -1131,13 +1131,12 @@
-
-
@@ -1261,7 +1260,6 @@ {{/each}} -
-- 2.39.5