:param filter_q: filter of data to be applied
:return: The list, it can be empty if no one match the filter.
"""
- return self.auth.get_project_list()
+ if not filter_q:
+ filter_q = {}
+
+ return self.auth.get_project_list(filter_q)
def delete(self, session, _id, dry_run=False):
"""
"""
raise AuthconnNotImplementedException("Should have implemented this")
- 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
"""
raise AuthconnNotImplementedException("Should have implemented this")
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:
"_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")