X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fauthconn_keystone.py;h=b0cab0c7af6b1139583412b6fbcd45d792c31473;hp=e9173063669c44a830b4d5f2b8459fb8c7e7c8d2;hb=fa54cd99ee561e02ef95128cd3d25074aa1dbe54;hpb=2d5a515d32cf20f526e5922fae130868c9710dc3 diff --git a/osm_nbi/authconn_keystone.py b/osm_nbi/authconn_keystone.py index e917306..b0cab0c 100644 --- a/osm_nbi/authconn_keystone.py +++ b/osm_nbi/authconn_keystone.py @@ -347,10 +347,11 @@ class AuthconnKeystone(Authconn): self.logger.exception("Error during role deletion using keystone") raise AuthconnOperationException("Error during role deletion using Keystone") - def get_project_list(self): + def get_project_list(self, filter_q={}): """ Get all the projects. + :param filter_q: dictionary to filter project list. :return: list of projects """ try: @@ -360,6 +361,14 @@ class AuthconnKeystone(Authconn): "_id": project.id } for project in projects if project.name != self.admin_project] + allowed_fields = ["_id", "name"] + for key in filter_q.keys(): + if key not in allowed_fields: + continue + + projects = [project for project in projects + if filter_q[key] == project[key]] + return projects except ClientException: self.logger.exception("Error during user project listing using keystone")