From 173bb19544807233882904af17cd7e41619a9f25 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 12 Jan 2012 14:12:44 +0000 Subject: [PATCH] update user roles looks to work :-) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1230556 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/js/redback/user.js | 18 ++++++++++++++++++ .../src/main/webapp/js/redback/users.js | 3 +-- 2 files changed, 19 insertions(+), 2 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 55060ea1a..bea075bec 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 @@ -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; } 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 3b681b23b..e52d24780 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 @@ -206,8 +206,7 @@ $(function() { this.applicationRoles = ko.observableArray(new Array()); updateUserRoles=function(){ - $.log("updateUserRoles assigned:"+this.user.assignedRoles().length); - + this.user.updateAssignedRoles(); } } -- 2.39.5