updating current user uses a different api than updating any user

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/cac1aec9
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/cac1aec9
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/cac1aec9

Branch: refs/heads/master
Commit: cac1aec9df917fda2642fc80efb7ce77bbca22ac
Parents: 3980b41
Author: Jeremy Mitchell <[email protected]>
Authored: Thu Jul 13 12:05:04 2017 -0600
Committer: Dewayne Richardson <[email protected]>
Committed: Thu Jul 13 12:10:11 2017 -0600

----------------------------------------------------------------------
 traffic_portal/app/src/common/api/UserService.js       | 13 +++++++++++++
 .../app/src/modules/private/user/UserController.js     |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cac1aec9/traffic_portal/app/src/common/api/UserService.js
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/common/api/UserService.js 
b/traffic_portal/app/src/common/api/UserService.js
index 3b187a1..575cd7d 100644
--- a/traffic_portal/app/src/common/api/UserService.js
+++ b/traffic_portal/app/src/common/api/UserService.js
@@ -86,6 +86,19 @@ var UserService = function(Restangular, $http, $location, 
$q, authService, httpS
             );
     };
 
+    this.updateCurrentUser = function(user) {
+        return $http.post(ENV.api['root'] + "user/current/update", { user: 
user })
+            .then(
+                function() {
+                    userModel.setUser(user);
+                    messageModel.setMessages([ { level: 'success', text: 
'Current user updated' } ], false);
+                },
+                function() {
+                    messageModel.setMessages([ { level: 'error', text: 
'Current user updated failed' } ], false);
+                }
+            );
+    };
+
     this.deleteUser = function(id) {
         return Restangular.one("users", id).remove()
             .then(

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cac1aec9/traffic_portal/app/src/modules/private/user/UserController.js
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/modules/private/user/UserController.js 
b/traffic_portal/app/src/modules/private/user/UserController.js
index 01439f9..86a7893 100644
--- a/traffic_portal/app/src/modules/private/user/UserController.js
+++ b/traffic_portal/app/src/modules/private/user/UserController.js
@@ -20,8 +20,8 @@
 var UserController = function($scope, $state, $location, $uibModal, formUtils, 
locationUtils, userService, authService, roleService, tenantService, userModel) 
{
 
     var updateUser = function(user, options) {
-        userService.updateUser(user)
-            .then(function() {
+        userService.updateCurrentUser(user).
+            then(function() {
                 if (options.signout) {
                     authService.logout();
                 }

Reply via email to