Bug 2392 Fixed: Error in getting data when logged in user updates username

Change-Id: I14293aa36061a02d304458a89fd74550143aeea5
Signed-off-by: Adurti <adurti.v@tataelxsi.co.in>
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_nbi/admin_topics.py b/osm_nbi/admin_topics.py
index e496806..540a5d9 100644
--- a/osm_nbi/admin_topics.py
+++ b/osm_nbi/admin_topics.py
@@ -72,7 +72,7 @@
         if session["admin"]:  # allows all
             return {}
         else:
-            return {"username": session["username"]}
+            return {"_id": session["user_id"]}
 
     def check_conflict_on_new(self, session, indata):
         # check username not exists
@@ -904,7 +904,7 @@
         :param db_content: The database content of this item _id
         :return: None if ok or raises EngineException with the conflict
         """
-        if db_content["username"] == session["username"]:
+        if db_content["_id"] == session["user_id"]:
             raise EngineException(
                 "You cannot delete your own login user ", http_code=HTTPStatus.CONFLICT
             )
@@ -1269,9 +1269,7 @@
         user_list = self.auth.get_user_list(filter_q)
         if not session["allow_show_user_project_role"]:
             # Bug 853 - Default filtering
-            user_list = [
-                usr for usr in user_list if usr["username"] == session["username"]
-            ]
+            user_list = [usr for usr in user_list if usr["_id"] == session["user_id"]]
         return user_list
 
     def delete(self, session, _id, dry_run=False, not_send_msg=None):
@@ -1478,7 +1476,7 @@
         project_list = self.auth.get_project_list(filter_q)
         if not session["allow_show_user_project_role"]:
             # Bug 853 - Default filtering
-            user = self.auth.get_user(session["username"])
+            user = self.auth.get_user(session["user_id"])
             projects = [prm["project"] for prm in user["project_role_mappings"]]
             project_list = [proj for proj in project_list if proj["_id"] in projects]
         return project_list
@@ -1780,7 +1778,7 @@
         role_list = self.auth.get_role_list(filter_q)
         if not session["allow_show_user_project_role"]:
             # Bug 853 - Default filtering
-            user = self.auth.get_user(session["username"])
+            user = self.auth.get_user(session["user_id"])
             roles = [prm["role"] for prm in user["project_role_mappings"]]
             role_list = [role for role in role_list if role["_id"] in roles]
         return role_list