summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrakiss <grakiss.wanglei@huawei.com>2017-11-08 07:58:34 +0000
committerLeo wang <grakiss.wanglei@huawei.com>2017-11-09 11:24:49 +0000
commit135db0c9860db436a2036f2bcb6f45b164f5b848 (patch)
tree653c2ffab7987262e1c16586e210dbf7fd09685e
parentc198d74138a590d8d586e7998d75ebe69fe702ed (diff)
[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 <grakiss.wanglei@huawei.com>
-rw-r--r--cvp/opnfv_testapi/resources/handlers.py26
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: