fix possible javascript npe

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1469298 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-04-18 12:43:25 +00:00
parent 1c655131b0
commit 3bba579fe4
1 changed files with 6 additions and 1 deletions

View 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);