add ldapgroup mapping UI part

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1450733 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-27 11:01:07 +00:00
parent 715f2f3fb6
commit cf2bbb9032
2 changed files with 32 additions and 10 deletions

View File

@ -1698,6 +1698,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
}
self.modifiesLdapGroupMappings=ko.observableArray([]);
}
this.modifiesLdapGroupMappings=ko.observableArray([]);
this.modifyLdapGroupMapping=function(roleNames,ldapGroupMapping){
var toAdd=true;
@ -1711,6 +1712,13 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
}
$.log('modifyLdapGroupMapping:'+ldapGroupMapping.group()+','+self.modifiesLdapGroupMappings().length);
};
addLdapGroupMapping=function(){
$.log("addLdapGroupMapping");
self.redbackRuntimeConfiguration().ldapGroupMappings.push(new LdapGroupMapping("",[],false,self.modifyLdapGroupMapping));
$("#ldap-group-mappings-div select" ).select2({width: "element"});
}
}
ManagerImplementationInformation=function(beanId,descriptionKey,readOnly){
@ -1806,9 +1814,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations,rbacManagerImplementationInformations);
var groups=[];
$.log("before useLdap");
var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.userManagerImpls())>0
||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls())>0;
$.log("before useLdap:"+$.inArray("ldap",redbackRuntimeConfiguration.userManagerImpls())
+','+$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls()));
var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.userManagerImpls())>=0
||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls())>=0;
$.log("useLdap:"+useLdap);
if(useLdap){
// load ldap roles
@ -1887,6 +1896,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
}
LdapGroupMapping=function(group,roleNames,automatic,subscribeFn){
$.log("new LdapGroupMapping");
var self=this;
this.modified=ko.observable(false);
//private String group;
@ -1894,7 +1904,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
this.group.subscribe(function(newValue){
self.modified(true);
if(subscribeFn){
subscribeFn(newValue)
subscribeFn(newValue,self)
}
});

View File

@ -1266,17 +1266,29 @@
<tbody id="ldap-group-mappings-tbody">
{{each(i, ldapGroupMapping) ldapGroupMappings()}}
<tr>
<td>${ldapGroupMapping.group()}</td>
<td>${ldapGroupMapping.group()}
<select id="roles-group-${ldapGroupMapping.group()}" data-bind="options: ldapGroups, value: ldapGroupMapping.group, optionsCaption: 'Select a LDAP Group'"
size="1"></select>
</td>
<td>
<div>
<select id="roles-group-${ldapGroupMapping.group()}" data-bind="options: $parent.allRoleNames, selectedOptions: ldapGroupMapping.roleNames"
size="5" multiple="true" ></select>
</div>
<select id="roles-group-mapping-${ldapGroupMapping.group()}" data-bind="options: $parent.allRoleNames, selectedOptions: ldapGroupMapping.roleNames"
size="5" multiple="true" ></select>
</td>
</tr>
{{/each}}
</tbody>
</table>
<div>
<span class="btn btn-success">
<i class="icon-plus-sign icon-white" title="add mapping" data-bind="click: function(){ addLdapGroupMapping() }"/>
</span>
<table class="table table-condensed">
<tr>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
</script>