Fix for bug 1447 Grafana user not associated with team
[osm/MON.git] / osm_mon / core / common_db.py
index e43c6cd..aa65388 100644 (file)
@@ -62,9 +62,9 @@ class CommonDbClient:
                                       {"_id": vnfd_id})
         return vnfd
 
-    def get_vnfd_by_id(self, vnfd_id: str):
-        vnfd = self.common_db.get_one("vnfds",
-                                      {"id": vnfd_id})
+    def get_vnfd_by_id(self, vnfd_id: str, filter: dict = {}):
+        filter["id"] = vnfd_id
+        vnfd = self.common_db.get_one("vnfds", filter)
         return vnfd
 
     def get_vnfd_by_name(self, vnfd_name: str):
@@ -162,3 +162,6 @@ class CommonDbClient:
 
     def get_role_by_name(self, name: str):
         return self.common_db.get_one('roles', {'name': name})
+
+    def get_role_by_id(self, role_id: str):
+        return self.common_db.get_one('roles', {'_id': role_id})