Maintain format of project_role_mappings for creating and listing 80/7580/1
authorEduardo Sousa <eduardo.sousa@canonical.com>
Thu, 30 May 2019 12:18:36 +0000 (13:18 +0100)
committerEduardo Sousa <eduardo.sousa@canonical.com>
Thu, 30 May 2019 12:18:36 +0000 (13:18 +0100)
Change-Id: Ia6e8589357b491cefe88101ff74844789059a016
Signed-off-by: Eduardo Sousa <eduardo.sousa@canonical.com>
osm_nbi/admin_topics.py

index eb8c988..bc2c7d9 100644 (file)
@@ -478,7 +478,7 @@ class UserTopicAuth(UserTopic):
 
         for project in content["projects"]:
             for role in project["roles"]:
-                project_role_mappings.append([project, role])
+                project_role_mappings.append({"project": project, "role": role})
         
         del content["projects"]
         content["project_role_mappings"] = project_role_mappings
@@ -569,15 +569,15 @@ class UserTopicAuth(UserTopic):
                 for mapping in mappings_to_remove:
                     self.auth.remove_role_from_user(
                         user["name"], 
-                        mapping[0],
-                        mapping[1]
+                        mapping["project"],
+                        mapping["role"]
                     )
                 
                 for mapping in mappings_to_add:
                     self.auth.assign_role_to_user(
                         user["name"], 
-                        mapping[0],
-                        mapping[1]
+                        mapping["project"],
+                        mapping["role"]
                     )
 
             return content["_id"]