usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [17/19] incubator-usergrid git commit: [USERGRID-642] Remove password properties from user objects in portal
Date Fri, 22 May 2015 00:22:15 GMT
[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-641
Commit: 53563e83b45b85c30a756530f366b6312f6d45ac
Parents: b28aeee
Author: ryan bridges <ryanb@apache.org>
Authored: Thu May 21 12:17:01 2015 -0400
Committer: ryan bridges <ryanb@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.");
     });
 


Mime
View raw message