From 135db0c9860db436a2036f2bcb6f45b164f5b848 Mon Sep 17 00:00:00 2001 From: grakiss Date: Wed, 8 Nov 2017 07:58:34 +0000 Subject: [cvp-web] Bugfix: Results shared by email are not shown on non-reviewer's pages JIRA: DOVETAIL-551 The CVP web portal can support share with name and share with email address. But when sharing with email, the pages of non-reviewers will not show the results shared by others. Change-Id: I94451448cc60d1f7a3472d756c502200757a16a8 Signed-off-by: grakiss --- cvp/opnfv_testapi/resources/handlers.py | 26 +++++++++++++++----------- 1 file 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: -- cgit 1.2.3-korg