diff options
Diffstat (limited to 'cvp/opnfv_testapi/resources')
-rw-r--r-- | cvp/opnfv_testapi/resources/handlers.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/cvp/opnfv_testapi/resources/handlers.py b/cvp/opnfv_testapi/resources/handlers.py index 51092b94..9b156e17 100644 --- a/cvp/opnfv_testapi/resources/handlers.py +++ b/cvp/opnfv_testapi/resources/handlers.py @@ -81,18 +81,22 @@ class GenericApiHandler(web.RequestHandler): role = self.get_secure_cookie(auth_const.ROLE) logging.info('role:%s', role) if role: + query['$or'] = [ + { + "shared": { + "$elemMatch": {"$eq": openid} + } + }, + {"owner": openid}, + { + "shared": { + "$elemMatch": {"$eq": user.get("email")} + } + } + ] + if role.find("reviewer") != -1: - query['$or'] = [{"shared": - {"$elemMatch": {"$eq": openid}}}, - {"owner": openid}, - {"shared": {"$elemMatch": - {"$eq": - user.get("email")}}}, - {"status": {"$ne": "private"}}] - else: - query['$or'] = [{"shared": - {"$elemMatch": {"$eq": openid}} - }, {"owner": openid}] + query['$or'].append({"status": {"$ne": "private"}}) elif k not in ['last', 'page', 'descend', 'per_page']: query[k] = v if date_range: |