[MRM-1714] using LDAP can be configurable with the ui

limit choice to a list of available implementations.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1413071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-11-23 21:33:34 +00:00
parent 29c5b26860
commit b3fec01ba6
2 changed files with 37 additions and 8 deletions

View File

@ -1155,9 +1155,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
this.userManagerImpl=ko.observable(userManagerImpl);
}
ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration){
ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration,userManagerImplementationInformations){
this.archivaRuntimeConfiguration=ko.observable(archivaRuntimeConfiguration);
self=this;
this.userManagerImplementationInformations=ko.observable(userManagerImplementationInformations);
var self=this;
saveArchivaRuntimeConfiguration=function(){
$.log("saveArchivaRuntimeConfiguration");
@ -1190,24 +1191,51 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
}
}
UserManagerImplementationInformation=function(beanId,descriptionKey){
this.beanId=beanId;
this.descriptionKey=descriptionKey;
this.description= $.i18n.prop(descriptionKey);
}
mapUserManagerImplementationInformations=function(data){
return $.map(data, function(item) {
return mapUserManagerImplementationInformation(item);
});
}
mapUserManagerImplementationInformation=function(data){
if(data==null){
return null;
}
return new UserManagerImplementationInformation(data.beanId,data.descriptionKey);
}
displayRuntimeConfiguration=function(){
$.log("displayRuntimeConfiguration");
var mainContent = $("#main-content");
mainContent.html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/userManagerImplementationInformation", {
type: "GET",
dataType: 'json',
success: function(data) {
var userManagerImplementationInformations=mapUserManagerImplementationInformations(data);
$.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/archivaRuntimeConfiguration", {
type: "GET",
dataType: 'json',
success: function(data) {
var archivaRuntimeConfiguration = mapArchivaRuntimeConfiguration(data);
var archivaRuntimeConfigurationViewModel = new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration);
var archivaRuntimeConfigurationViewModel =
new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration,userManagerImplementationInformations);
mainContent.html( $( "#runtime-configuration-main" ).tmpl( ) );
ko.applyBindings(archivaRuntimeConfigurationViewModel,$("#runtime-configuration-content" ).get(0));
}
});
}
});
}
mapArchivaRuntimeConfiguration=function(data){
return new ArchivaRuntimeConfiguration(data.userManagerImpl);

View File

@ -904,6 +904,7 @@
${$.i18n.prop('runtime-configuration.usermanager.label')}
</label>
<div class="controls">
<select data-bind="options: userManagerImplementationInformations,optionsValue: 'beanId', optionsText: 'description', value: archivaRuntimeConfiguration().userManagerImpl, optionsCaption: 'Choose...'"></select>
<input type="text" id="userManagerImpl" name="userManagerImpl" class="input-small required"
data-bind="value: archivaRuntimeConfiguration().userManagerImpl"/>
</div>