mirror of
https://github.com/apache/archiva.git
synced 2025-03-07 00:49:49 +00:00
start ui for ldap group <-> roles mapping
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1444879 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
59989f2bc7
commit
fc846059c1
@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid",
|
||||
"knockout.sortable","jquery.validate","bootstrap"]
|
||||
"knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2"]
|
||||
, function(jquery,i18n,utils,jqueryTmpl,ko) {
|
||||
|
||||
//-------------------------
|
||||
@ -1257,6 +1257,11 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||
this.usersCacheConfiguration=ko.observable(cacheConfiguration);
|
||||
this.usersCacheConfiguration.subscribe(function(newValue){self.modified(true)});
|
||||
|
||||
this.ldapGroups=ko.observableArray([]);
|
||||
this.ldapGroups.subscribe(function(newValue){self.modified(true)});
|
||||
|
||||
this.ldapGroupMappings=ko.observableArray([]);
|
||||
this.ldapGroupMappings.subscribe(function(newValue){self.modified(true);});
|
||||
|
||||
}
|
||||
|
||||
@ -1349,6 +1354,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||
|
||||
this.usedUserManagerImpls=ko.observableArray([]);
|
||||
|
||||
this.allRoleNames=[];
|
||||
|
||||
self.gridViewModel = new ko.simpleGrid.viewModel({
|
||||
data: self.redbackRuntimeConfiguration().configurationPropertiesEntries,
|
||||
columns: [
|
||||
@ -1615,10 +1622,60 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||
var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
|
||||
var redbackRuntimeConfigurationViewModel =
|
||||
new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations);
|
||||
mainContent.html( $("#redback-runtime-configuration-main" ).tmpl() );
|
||||
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
|
||||
activateRedbackRuntimeGeneralFormValidation();
|
||||
activateLdapConfigurationFormValidation();
|
||||
|
||||
|
||||
// load ldap roles
|
||||
$.ajax("restServices/redbackServices/ldapGroupMappingService/ldapGroups", {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var groups = [];
|
||||
if(data&&data.strings){
|
||||
groups = $.isArray(data.strings)? $.map(data.strings,function(item){
|
||||
return item;
|
||||
}):[data.strings];
|
||||
}
|
||||
$.log("groups number:"+groups.length);
|
||||
redbackRuntimeConfiguration.ldapGroups.push(groups);
|
||||
|
||||
// load ldap group mappings if any
|
||||
$.ajax("restServices/redbackServices/ldapGroupMappingService", {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var groupMappings=mapLdapGroupMappings(data);
|
||||
|
||||
redbackRuntimeConfiguration.ldapGroupMappings(groupMappings);
|
||||
redbackRuntimeConfiguration.modified(false);
|
||||
|
||||
|
||||
$.ajax("restServices/redbackServices/roleManagementService/allRoles", {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
|
||||
var allRoleNames = $.map(data, function(item) {
|
||||
return item.name;
|
||||
});
|
||||
|
||||
redbackRuntimeConfigurationViewModel.allRoleNames=allRoleNames;
|
||||
|
||||
mainContent.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"});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -1627,6 +1684,27 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
||||
|
||||
}
|
||||
|
||||
LdapGroupMapping=function(group,roleNames){
|
||||
var self=this;
|
||||
this.modified=ko.observable(false);
|
||||
//private String group;
|
||||
this.group=ko.observable(group);
|
||||
this.group.subscribe(function(newValue){self.modified(true)});
|
||||
|
||||
//private Collection<String> roleNames;
|
||||
this.roleNames=ko.observableArray(roleNames);
|
||||
this.roleNames.subscribe(function(newValue){self.modified(true)});
|
||||
}
|
||||
|
||||
mapLdapGroupMappings=function(data){
|
||||
if(data!=null){
|
||||
return $.map(data,function(item){
|
||||
return new LdapGroupMapping(item.group,item.roleNames?item.roleNames:[]);
|
||||
})
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
CacheConfiguration=function(timeToIdleSeconds,timeToLiveSeconds,maxElementsInMemory,maxElementsOnDisk){
|
||||
var self=this;
|
||||
this.modified=ko.observable(false);
|
||||
|
@ -976,6 +976,7 @@ <h2>${$.i18n.prop('redback-runtime-configuration.title')}</h2>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active" id="redback-runtime-general-li"><a href="#redback-runtime-general-content" data-toggle="tab">${$.i18n.prop('redback.runtime.general.title')}</a></li>
|
||||
<li id="redback-runtime-ldap-li"><a href="#redback-runtime-ldap-content" data-toggle="tab">${$.i18n.prop('redback.runtime.ldap.title')}</a></li>
|
||||
<li id="redback-ldap-mapping-li"><a href="#redback-runtime-ldap-mapping" data-toggle="tab">${$.i18n.prop('redback.runtime.ldap.mapping.title')}</a></li>
|
||||
<li id="redback-runtime-properties-li"><a href="#redback-runtime-properties-content" data-toggle="tab">${$.i18n.prop('redback.runtime.properties.title')}</a></li>
|
||||
<li id="redback-runtime-users-cache-li"><a href="#redback-runtime-users-cache-content" data-toggle="tab">${$.i18n.prop('redback.runtime.users.cache.title')}</a></li>
|
||||
</ul>
|
||||
@ -1091,10 +1092,14 @@ <h5>${$.i18n.prop('redback.runtime.user-managers.impls.available')}</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="redback-runtime-ldap-mapping" data-bind='template: {name:"redback-runtime-ldap-mapping-tmpl",data: redbackRuntimeConfiguration}'>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="redback-runtime-properties-content">
|
||||
|
||||
<div class="well">
|
||||
<table id="proxyConnectorsTable"
|
||||
<table id="proxyConnectorsTable" class="table-hover"
|
||||
data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'properties-grid',pageLinksId:'properties-grid-pagination'">
|
||||
</table>
|
||||
<div id="properties-grid-pagination"></div>
|
||||
@ -1192,3 +1197,31 @@ <h5>${$.i18n.prop('redback.runtime.user-managers.impls.available')}</h5>
|
||||
${$data.description}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script id="redback-runtime-ldap-mapping-tmpl" type="text/html">
|
||||
<div class="well" id="ldap-group-mappings-div">
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>group</th>
|
||||
<th>roles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="ldap-group-mappings-tbody">
|
||||
{{each(i, ldapGroupMapping) ldapGroupMappings()}}
|
||||
<tr>
|
||||
<td>${ldapGroupMapping.group()}</td>
|
||||
<td>
|
||||
<div>
|
||||
<select id="roles-group-${ldapGroupMapping.group()}" data-bind="options: $parent.allRoleNames, selectedOptions: ldapGroupMapping.roleNames()"
|
||||
size="5" multiple="true" ></select>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user