You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/05/26 20:13:20 UTC

[21/22] incubator-usergrid git commit: [USERGRID-642] Remove password properties from user objects in portal

[USERGRID-642] Remove password properties from user objects in portal


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

Branch: refs/heads/USERGRID-608
Commit: 53563e83b45b85c30a756530f366b6312f6d45ac
Parents: b28aeee
Author: ryan bridges <ry...@apache.org>
Authored: Thu May 21 12:17:01 2015 -0400
Committer: ryan bridges <ry...@apache.org>
Committed: Thu May 21 12:17:01 2015 -0400

----------------------------------------------------------------------
 portal/js/users/users-controller.js | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/53563e83/portal/js/users/users-controller.js
----------------------------------------------------------------------
diff --git a/portal/js/users/users-controller.js b/portal/js/users/users-controller.js
index fa489f7..3978357 100644
--- a/portal/js/users/users-controller.js
+++ b/portal/js/users/users-controller.js
@@ -61,15 +61,29 @@ AppServices.Controllers.controller('UsersCtrl', ['ug', '$scope', '$rootScope', '
           clearNewUserForm();
           break;
       }
-    }
+    };
 
     ug.getUsers();
+    function sanitizeUsersCollection(){
+      var cleanProperties = ["password", "oldpassword", "newpassword"]
+      if($scope.usersCollection._list.length > 0){
+        $scope.usersCollection._list.forEach(function(user, i){
+          Object.keys(user._data).forEach(function(key){
+            if(cleanProperties.indexOf(key.toLowerCase()) !== -1){
+              // console.warn("Removing %s from %s", key, user._data.uuid);
+              delete user._data[key]
+            }
+          });
+          $scope.usersCollection._list[i]=user;
+        })
+      }
+    }
 
     $scope.$on('users-received', function(event, users) {
       $scope.usersCollection = users;
       $scope.usersSelected = false;
       $scope.hasUsers = users._list.length;
-
+      sanitizeUsersCollection();
       if(users._list.length > 0){
         $scope.selectUser(users._list[0]._data.uuid)
       }
@@ -79,6 +93,7 @@ AppServices.Controllers.controller('UsersCtrl', ['ug', '$scope', '$rootScope', '
     });
 
     $scope.$on('users-create-success', function () {
+      sanitizeUsersCollection();
       $rootScope.$broadcast("alert", "success", "User successfully created.");
     });