]> source.dussan.org Git - archiva.git/commitdiff
fix issue for update user flags just after creation
authorOlivier Lamy <olamy@apache.org>
Fri, 13 Jan 2012 17:00:04 +0000 (17:00 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 13 Jan 2012 17:00:04 +0000 (17:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1231179 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js

index 7465707dbb3b1facde346f3035c05522949d27e6..e9633e555538b717de888623fd2eecc9c5ad3e75 100644 (file)
@@ -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;
   }
 
   /**
index e52d24780c09290ed035a5c8226b6b8b0acc3006..888def24cb86188738b305def7859ccfbb78b27a 100644 (file)
@@ -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() {