From: Olivier Lamy Date: Fri, 13 Jan 2012 17:00:04 +0000 (+0000) Subject: fix issue for update user flags just after creation X-Git-Tag: archiva-1.4-M3~1599 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1c00503df1b226d58fbbaf3dafcc5154875b1367;p=archiva.git fix issue for update user flags just after creation git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1231179 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js index 7465707db..e9633e555 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js @@ -137,7 +137,7 @@ $(function() { var currentUser = this; openDialogConfirm(function(){ - $.ajax("restServices/redbackServices/userService/deleteUser/"+currentUser.username(), { + $.ajax("restServices/redbackServices/userService/deleteUser/"+encodeURIComponent(currentUser.username()), { type: "GET", dataType: 'json', success: function(data) { @@ -221,7 +221,59 @@ $(function() { }); } - this.i18n = $.i18n.prop; + this.lock=function(){ + this.locked(true); + var curUser = this; + clearUserMessages(); + $.ajax("restServices/redbackServices/userService/lockUser/"+encodeURIComponent(curUser.username()), { + type: "GET", + success: function(result) { + displaySuccessMessage($.i18n.prop("user.locked",curUser.username())); + }, + error: function(result) { + var obj = jQuery.parseJSON(result.responseText); + displayRedbackError(obj); + } + }); + } + + this.unlock=function(){ + this.locked(false); + var curUser = this; + clearUserMessages(); + $.ajax("restServices/redbackServices/userService/unlockUser/"+encodeURIComponent(curUser.username()), { + type: "GET", + success: function(result) { + displaySuccessMessage($.i18n.prop("user.unlocked",curUser.username())); + }, + error: function(result) { + var obj = jQuery.parseJSON(result.responseText); + displayRedbackError(obj); + } + }); + } + + // value is boolean + this.changePasswordChangeRequired=function(value){ + this.passwordChangeRequired(value); + var curUser = this; + var url = "restServices/redbackServices/userService/passwordChangeRequired/"+encodeURIComponent(curUser.username()); + if (value==false){ + url = "restServices/redbackServices/userService/passwordChangeNotRequired/"+encodeURIComponent(curUser.username()); + } + $.ajax(url, { + type: "GET", + success: function(result) { + displaySuccessMessage($.i18n.prop("user.passwordChangeRequired.updated",curUser.username())); + }, + error: function(result) { + var obj = jQuery.parseJSON(result.responseText); + displayRedbackError(obj); + } + }); + }; + + this.i18n = $.i18n.prop; } /** diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js index e52d24780..888def24c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js @@ -88,23 +88,17 @@ $(function() { this.lock = function(user){ clearUserMessages(); - user.locked(true); - window.redbackModel.createUser=false; - user.save(); + user.lock(); } this.unlock = function(user){ clearUserMessages(); - user.locked(false); - window.redbackModel.createUser=false; - user.save(); + user.unlock(); } this.passwordChangeRequire = function(user,forceChangedPassword){ clearUserMessages(); - user.passwordChangeRequired(forceChangedPassword); - window.redbackModel.createUser=false; - user.save(); + user.changePasswordChangeRequired(forceChangedPassword); } this.sortByName = function() {