aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-10-28 12:49:20 +0300
committerBonfaceKilz2021-11-04 15:22:41 +0300
commitfbbdca01308610813aa7f77deb120e95aed8df6e (patch)
treeda0a89f1d7c5f18e72bf830bf997bc1977e86023
parent7bb86ff7e0b89fd714077a6d6b01f9b17f2ce953 (diff)
downloadgenenetwork2-fbbdca01308610813aa7f77deb120e95aed8df6e.tar.gz
Redirect to "no_access_page" for pages that need edit and edit-admin
-rw-r--r--wqflask/wqflask/decorators.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/wqflask/wqflask/decorators.py b/wqflask/wqflask/decorators.py
index 1ef8c188..319d9bd4 100644
--- a/wqflask/wqflask/decorators.py
+++ b/wqflask/wqflask/decorators.py
@@ -1,7 +1,7 @@
"""This module contains gn2 decorators"""
import redis
-from flask import current_app, g, request
+from flask import current_app, g, redirect, request, url_for
from typing import Dict
from urllib.parse import urljoin
from functools import wraps
@@ -51,7 +51,7 @@ are required"""
response = {}
if max([DataRole(role) for role in response.get(
"data", ["no-access"])]) < DataRole.EDIT:
- return "You need to have edit access", 401
+ return redirect(url_for("no_access_page"))
return f(*args, **kwargs)
return wrap
@@ -75,6 +75,6 @@ def edit_admins_access_required(f):
response = {}
if max([AdminRole(role) for role in response.get(
"admin", ["not-admin"])]) < AdminRole.EDIT_ADMINS:
- return "You need to have edit-admins access", 401
+ return redirect(url_for("no_access_page"))
return f(*args, **kwargs)
return wrap