]> source.dussan.org Git - archiva.git/commitdiff
update user roles looks to work :-)
authorOlivier Lamy <olamy@apache.org>
Thu, 12 Jan 2012 14:12:44 +0000 (14:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 12 Jan 2012 14:12:44 +0000 (14:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1230556 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 55060ea1a139fc4884f63feaf75bdd7cc812a3be..bea075bec87e152bf886a47ffdd6cfa8b754a24e 100644 (file)
@@ -202,6 +202,24 @@ $(function() {
         }
       }
 
+      this.updateAssignedRoles=function(){
+        $.log("user#updateAssignedRoles");
+        var curUser = this;
+        $.ajax("restServices/redbackServices/roleManagementService/updateUserRoles", {
+            data: "{\"user\": " +  ko.toJSON(this)+"}",
+            contentType: 'application/json',
+            type: "POST",
+            dataType: 'json',
+            success: function(result) {
+              displaySuccessMessage($.i18n.prop("user.roles.updated",curUser.username()));
+            },
+            error: function(result) {
+              var obj = jQuery.parseJSON(result.responseText);
+              displayRedbackError(obj);
+            }
+          });
+      }
+
       this.i18n = $.i18n.prop;
   }
 
index 3b681b23ba00a576d456ecf98ab73952b55bd0e1..e52d24780c09290ed035a5c8226b6b8b0acc3006 100644 (file)
@@ -206,8 +206,7 @@ $(function() {
     this.applicationRoles = ko.observableArray(new Array());
 
     updateUserRoles=function(){
-      $.log("updateUserRoles assigned:"+this.user.assignedRoles().length);
-
+      this.user.updateAssignedRoles();
     }
 
   }