diff options
author | Olivier Lamy <olamy@apache.org> | 2012-01-13 17:00:04 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-01-13 17:00:04 +0000 |
commit | 1c00503df1b226d58fbbaf3dafcc5154875b1367 (patch) | |
tree | c40fb1150448a79e9c593491583d85c52cd9cc70 | |
parent | c7c60af8cb1c3f3a1b559a00f8ecbcb03b245ed9 (diff) | |
download | archiva-1c00503df1b226d58fbbaf3dafcc5154875b1367.tar.gz archiva-1c00503df1b226d58fbbaf3dafcc5154875b1367.zip |
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
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js | 56 | ||||
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js | 12 |
2 files changed, 57 insertions, 11 deletions
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() { |