do not ask ldap informations if ldap is not activated

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1447203 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-18 11:21:58 +00:00
parent f127c7f705
commit fc19422920
1 changed files with 60 additions and 55 deletions

View File

@ -1714,6 +1714,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.usedUserManagerImpls)>0
||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls)>0;
$.log("useLdap:"+useLdap);
if(useLdap){
// load ldap roles
$.ajax("restServices/redbackServices/ldapGroupMappingService/ldapGroups", {
type: "GET",
@ -1739,13 +1740,31 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
type: "GET",
dataType: 'json',
success: function(data) {
displayRuntimeConfigurationScreen(redbackRuntimeConfigurationViewModel,data,groupMappings,groups);
}
});
}
});
}
);
} else {
displayRuntimeConfigurationScreen(redbackRuntimeConfigurationViewModel,null,null);
}
}
});
var allRoleNames = $.map(data, function(item) {
}
});
}
displayRuntimeConfigurationScreen=function(redbackRuntimeConfigurationViewModel,allRoles,groupMappings,groups){
var allRoleNames = $.map(allRoles?allRoles:[], function(item) {
return item.name;
});
redbackRuntimeConfigurationViewModel.allRoleNames=allRoleNames;
if (redbackRuntimeConfiguration.ldapConfiguration().useRoleNameAsGroup()) {
if (redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().ldapConfiguration().useRoleNameAsGroup()) {
// if using groups == roles add all as mapping except already mapped
$.each(groups,function(idx,item){
var exists=false;
@ -1761,28 +1780,14 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
});
}
redbackRuntimeConfiguration.ldapGroupMappings=ko.observableArray(groupMappings);
redbackRuntimeConfiguration.modified(false);
redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().ldapGroupMappings=ko.observableArray(groupMappings?groupMappings:[]);
redbackRuntimeConfigurationViewModel.redbackRuntimeConfiguration().modified(false);
mainContent.html( $("#redback-runtime-configuration-main" ).tmpl() );
$("#main-content").html( $("#redback-runtime-configuration-main" ).tmpl() );
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
activateRedbackRuntimeGeneralFormValidation();
activateLdapConfigurationFormValidation();
$("#ldap-group-mappings-div select" ).select2({width: "element"});
}
});
}
});
}
);
}
});
}
});
}
LdapGroupMapping=function(group,roleNames,automatic,subscribeFn){