mirror of https://github.com/apache/archiva.git
[MRM-1736] fix ui to update rbacmanager used.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1448333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dabfdcec7e
commit
94defd4909
|
@ -1275,7 +1275,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
new RedbackRuntimeConfiguration(data.userManagerImpls,ldapConfiguration,data.migratedFromRedbackConfiguration,[]
|
||||
,data.useUsersCache,mapCacheConfiguration(data.usersCacheConfiguration),data.rbacManagerImpls);
|
||||
|
||||
|
||||
$.log("redbackRuntimeConfiguration.rbacManagerImpls:"+redbackRuntimeConfiguration.rbacManagerImpls().length);
|
||||
var configurationPropertiesEntries = data.configurationPropertiesEntries == null ? []: $.each(data.configurationPropertiesEntries,function(item){
|
||||
var entry = new Entry(item.key, item.value,function(newValue){
|
||||
redbackRuntimeConfiguration.modified(true);
|
||||
|
@ -1376,7 +1376,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
|
||||
this.usedUserManagerImpls=ko.observableArray([]);
|
||||
|
||||
this.rbacManagerImpls=ko.observableArray([]);
|
||||
this.usedRbacManagerImpls=ko.observableArray([]);
|
||||
|
||||
this.modifiesLdapGroupMappings=ko.observableArray([]);
|
||||
|
||||
|
@ -1409,6 +1409,15 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
}
|
||||
}
|
||||
|
||||
findRbacManagerImplementationInformation=function(id){
|
||||
for(var i= 0;i<self.rbacManagerImplementationInformations().length;i++){
|
||||
$.log(id+""+self.rbacManagerImplementationInformations()[i].beanId);
|
||||
if(id==self.rbacManagerImplementationInformations()[i].beanId){
|
||||
return self.rbacManagerImplementationInformations()[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkLdapServerConfiguration=function(){
|
||||
$.log("checkLdapServerConfiguration");
|
||||
clearUserMessages();
|
||||
|
@ -1467,7 +1476,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
|
||||
for(var i= 0;i<redbackRuntimeConfiguration.userManagerImpls().length;i++){
|
||||
var id=redbackRuntimeConfiguration.userManagerImpls()[i];
|
||||
$.log("id:"+id);
|
||||
|
||||
var userManagerImplementationInformation=findUserManagerImplementationInformation(id);
|
||||
|
||||
if(userManagerImplementationInformation!=null){
|
||||
|
@ -1475,6 +1484,20 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
}
|
||||
}
|
||||
|
||||
$.log("init usedUserManagerImpls done");
|
||||
|
||||
for(var i= 0;i<redbackRuntimeConfiguration.rbacManagerImpls().length;i++){
|
||||
var id=redbackRuntimeConfiguration.rbacManagerImpls()[i];
|
||||
|
||||
var rbacManagerImplementationInformation=findRbacManagerImplementationInformation(id);
|
||||
|
||||
if(rbacManagerImplementationInformation!=null){
|
||||
this.usedRbacManagerImpls.push(rbacManagerImplementationInformation);
|
||||
}
|
||||
}
|
||||
|
||||
$.log("init usedUserManagerImpls done");
|
||||
|
||||
isUsedUserManagerImpl=function(userManagerImplementationInformation){
|
||||
for(var i=0;i<self.usedUserManagerImpls().length;i++){
|
||||
if(self.usedUserManagerImpls()[i].beanId==userManagerImplementationInformation.beanId){
|
||||
|
@ -1490,7 +1513,6 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
if(!isUsedUserManagerImpl(self.userManagerImplementationInformations()[i])){
|
||||
self.availableUserManagerImpls.push(self.userManagerImplementationInformations()[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
userManagerImplMoved=function(arg){
|
||||
|
@ -1498,6 +1520,28 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
self.redbackRuntimeConfiguration().modified(true);
|
||||
}
|
||||
|
||||
isUsedRbacManagerImpl=function(rbacManagerImplementationInformation){
|
||||
for(var i=0;i<self.usedRbacManagerImpls().length;i++){
|
||||
if(self.usedRbacManagerImpls()[i].beanId==rbacManagerImplementationInformation.beanId){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.availableRbacManagerImpls=ko.observableArray([]);
|
||||
|
||||
for(var i=0;i<self.rbacManagerImplementationInformations().length;i++){
|
||||
if(!isUsedRbacManagerImpl(self.rbacManagerImplementationInformations()[i])){
|
||||
self.availableRbacManagerImpls.push(self.rbacManagerImplementationInformations()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
rbacManagerImplMoved=function(arg){
|
||||
$.log("rbacManagerImplMoved");
|
||||
self.redbackRuntimeConfiguration().modified(true);
|
||||
}
|
||||
|
||||
saveRedbackRuntimeConfiguration=function(){
|
||||
|
||||
var mainContent=$("#main-content");
|
||||
|
@ -1528,6 +1572,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
clearUserMessages();
|
||||
var userMessages=$("#user-messages");
|
||||
userMessages.html(mediumSpinnerImg());
|
||||
|
||||
self.redbackRuntimeConfiguration().userManagerImpls=ko.observableArray([]);
|
||||
|
||||
for(var i=0;i<self.usedUserManagerImpls().length;i++){
|
||||
|
@ -1535,6 +1580,17 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
$.log("beanId:"+beanId);
|
||||
self.redbackRuntimeConfiguration().userManagerImpls.push(beanId);
|
||||
}
|
||||
|
||||
|
||||
self.redbackRuntimeConfiguration().rbacManagerImpls=ko.observableArray([]);
|
||||
|
||||
for(var i=0;i<self.usedRbacManagerImpls().length;i++){
|
||||
var beanId=self.usedRbacManagerImpls()[i].beanId;
|
||||
$.log("beanId:"+beanId);
|
||||
self.redbackRuntimeConfiguration().rbacManagerImpls.push(beanId);
|
||||
}
|
||||
|
||||
|
||||
$.log("rememberme enabled:"+self.redbackRuntimeConfiguration().findPropertyValue("security.rememberme.enabled"));
|
||||
$.ajax("restServices/archivaServices/redbackRuntimeConfigurationService/redbackRuntimeConfiguration",
|
||||
{
|
||||
|
@ -1710,12 +1766,14 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
|
||||
$.log("before new RedbackRuntimeConfigurationViewModel");
|
||||
var redbackRuntimeConfigurationViewModel =
|
||||
new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations,rbacManagerImplementationInformations);
|
||||
|
||||
var groups=[];
|
||||
var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.usedUserManagerImpls)>0
|
||||
||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls)>0;
|
||||
$.log("before useLdap");
|
||||
var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.userManagerImpls())>0
|
||||
||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls())>0;
|
||||
$.log("useLdap:"+useLdap);
|
||||
if(useLdap){
|
||||
// load ldap roles
|
||||
|
|
|
@ -1005,14 +1005,14 @@
|
|||
<div class="span4 dotted">
|
||||
<h5>${$.i18n.prop('redback.runtime.rbac-managers.impls.choosed')}</h5>
|
||||
<div style="min-height: 40px" id="rbac-mananagers-sortables-choosed"
|
||||
data-bind="sortable: { template: 'redback-runtime-general-content-impl-informations', data:usedUserManagerImpls,afterMove: userManagerImplMoved}">
|
||||
data-bind="sortable: { template: 'redback-runtime-general-content-impl-informations', data:usedRbacManagerImpls,afterMove: rbacManagerImplMoved}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="span4 dotted">
|
||||
<h5>${$.i18n.prop('redback.runtime.rbac-managers.impls.available')}</h5>
|
||||
<div style="min-height: 40px"id="rbac-mananagers-sortables-availables"
|
||||
data-bind="sortable: {template: 'redback-runtime-general-content-impl-informations',data:availableUserManagerImpls,afterMove: userManagerImplMoved}">
|
||||
data-bind="sortable: {template: 'redback-runtime-general-content-impl-informations',data:availableRbacManagerImpls,afterMove: rbacManagerImplMoved}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue