aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js63
1 files changed, 36 insertions, 27 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js
index 184cbb263..c27fd2580 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js
@@ -1643,39 +1643,44 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
$.log("save modifiesLdapGroupMappings");
var message=$.i18n.prop('redback-runtime-ldap-group-mapping.updated');
var userMessages=$("#user-messages");
+ var ldapGroupMappings=[];
$.each(self.modifiesLdapGroupMappings(),function(idx,item){
- if(!(item.automatic&item.roleNames().length<2)){
- userMessages.empty();
+ if(!(item.automatic&item.roleNames().length<2)){
$.log("update mapping for group:"+item.group());
- var mainContent=$("#main-content");
- var saveButton = mainContent.find("#redback-runtime-configuration-save" );
- saveButton.button('loading');
- userMessages.html(mediumSpinnerImg());
- $.ajax("restServices/redbackServices/ldapGroupMappingService",
- {
- type: "POST",
- contentType: 'application/json',
- data:ko.toJSON(item),
- dataType: 'json',
- success: function(data) {
- userMessages.html($.tmpl($("#alert-message-success").html(), { "message" : message }));
- },
- error: function(data) {
- var res = $.parseJSON(data.responseText);
- displayRestError(res);
- },
- complete:function(data){
- removeMediumSpinnerImg(userMessages);
- saveButton.button('reset');
- self.redbackRuntimeConfiguration().modified(false);
- self.redbackRuntimeConfiguration().ldapConfiguration().modified(false);
- }
- }
- );
+ ldapGroupMappings.push(item);
}
});
+ if (ldapGroupMappings.length>0){
+
+ var mainContent=$("#main-content");
+ var saveButton = mainContent.find("#redback-runtime-configuration-save" );
+ saveButton.button('loading');
+ userMessages.html(mediumSpinnerImg());
+ $.ajax("restServices/redbackServices/ldapGroupMappingService",
+ {
+ type: "POST",
+ contentType: 'application/json',
+ data:ko.toJSON(new LdapGroupMappingUpdateRequest(ldapGroupMappings)),
+ dataType: 'json',
+ success: function(data) {
+ displaySuccessMessage(message);
+ },
+ error: function(data) {
+ var res = $.parseJSON(data.responseText);
+ displayRestError(res);
+ },
+ complete:function(data){
+ removeMediumSpinnerImg(userMessages);
+ saveButton.button('reset');
+ self.redbackRuntimeConfiguration().modified(false);
+ self.redbackRuntimeConfiguration().ldapConfiguration().modified(false);
+ }
+ }
+ );
+ }
+
} else {
$.log("not save modifiesLdapGroupMappings");
@@ -2013,6 +2018,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
this.update=true;
}
+ LdapGroupMappingUpdateRequest=function(ldapGroupMappings){
+ this.ldapGroupMappings=ko.observableArray(ldapGroupMappings?ldapGroupMappings:[]);
+ }
+
mapLdapGroupMappings=function(data,modifyLdapGroupMapping){
if(data!=null){
return $.map(data,function(item){