From: Olivier Lamy Date: Thu, 18 Apr 2013 12:43:25 +0000 (+0000) Subject: fix possible javascript npe X-Git-Tag: archiva-1.4-M4~83 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3bba579fe447220c19be0dc4e8dc88c7168afe70;p=archiva.git fix possible javascript npe git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1469298 13f79535-47bb-0310-9956-ffa450edef68 --- 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 547254bc4..92fd0b3b8 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 @@ -1906,6 +1906,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" ||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls())>=0; $.log("useLdap:"+useLdap); if(useLdap){ + $.log("in get ldap groups"); + // load ldap roles $.ajax("restServices/redbackServices/ldapGroupMappingService/ldapGroups", { type: "GET", @@ -1939,6 +1941,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" } ); } else { + $.log("before displayRuntimeConfigurationScreen"); displayRuntimeConfigurationScreen(redbackRuntimeConfigurationViewModel,null,null); } } @@ -1955,7 +1958,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" }); redbackRuntimeConfigurationViewModel.allRoleNames=ko.observableArray(allRoleNames); - if (redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().ldapConfiguration().useRoleNameAsGroup()) { + + if (redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().ldapConfiguration().useRoleNameAsGroup()&&groups) { // if using groups == roles add all as mapping except already mapped $.each(groups,function(idx,item){ var exists=false; @@ -1971,6 +1975,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" }); } + redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().ldapGroupMappings=ko.observableArray(groupMappings?groupMappings:[]); redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().modified(false);