]> source.dussan.org Git - archiva.git/commitdiff
fix possible javascript npe
authorOlivier Lamy <olamy@apache.org>
Thu, 18 Apr 2013 12:43:25 +0000 (12:43 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 18 Apr 2013 12:43:25 +0000 (12:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1469298 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js

index 547254bc4da852b3a6bd7b972e0582862e7edec2..92fd0b3b80de3be39c916c1639f6489e1722b690 100644 (file)
@@ -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);