From da620c17769c0357e4a9137eedbb7cf044cc38d4 Mon Sep 17 00:00:00 2001 From: Panagiotis Karalis Date: Thu, 18 Apr 2019 18:48:22 +0300 Subject: Bug fix for ONAP/OVP portals During portal review, some errors have been noticed and fixed. - 'no role', In the 'My Results' page are displayed also results from other users. - 'user,reviewer' role, In the 'My Results' page are appeared all results and not only for the current user. - 'administrator' role, The applications are not appeared in the application page - 'reviewer' role, Reviewers cannot submit votes and after few seconds a 'time out' is received. Change-Id: Ia9bc3c4fdcac1b37ac03adff64ff689ca2428c0f Signed-off-by: Panagiotis Karalis --- opnfv_testapi/resources/handlers.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'opnfv_testapi/resources/handlers.py') diff --git a/opnfv_testapi/resources/handlers.py b/opnfv_testapi/resources/handlers.py index 559e689..df0cae5 100644 --- a/opnfv_testapi/resources/handlers.py +++ b/opnfv_testapi/resources/handlers.py @@ -79,6 +79,30 @@ class GenericApiHandler(web.RequestHandler): date_range.update({'$gte': str(v)}) elif k == 'to': date_range.update({'$lt': str(v)}) + elif k == 'applications': + role = self.get_secure_cookie(auth_const.ROLE) + logging.info('role:%s', role) + if role: + if role.find("administrator") != -1: + query['$or'] = [ + { + "status": { + "$ne": "private" + } + } + ] + elif k == 'review': + role = self.get_secure_cookie(auth_const.ROLE) + logging.info('role:%s', role) + if role: + if role.find("reviewer") != -1: + query['$or'] = [ + { + "status": { + "$ne": "private" + } + } + ] elif k == 'signed': openid = self.get_secure_cookie(auth_const.OPENID) user = yield dbapi.db_find_one("users", {'openid': openid}) @@ -98,9 +122,6 @@ class GenericApiHandler(web.RequestHandler): } } ] - - if role.find("reviewer") != -1: - query['$or'].append({"status": {"$ne": "private"}}) elif k == 'status': if v.startswith('{'): query[k] = json.loads(v) -- cgit 1.2.3-korg