aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-10-26 20:57:01 +0300
committerBonfaceKilz2021-10-28 08:34:35 +0300
commit46a9f5e522b96346034044b946ff85ac71197699 (patch)
tree2f490d6786aa0f46067dfaa2074829e1abf0a962
parent2b82f284efe60767c0e3f30e095094cee9c10a81 (diff)
downloadgenenetwork2-46a9f5e522b96346034044b946ff85ac71197699.tar.gz
Make DataRole and AdminRole available to all jinja templates
-rw-r--r--wqflask/wqflask/__init__.py11
-rw-r--r--wqflask/wqflask/resource_manager.py3
2 files changed, 12 insertions, 2 deletions
diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py
index a5097287..169192c7 100644
--- a/wqflask/wqflask/__init__.py
+++ b/wqflask/wqflask/__init__.py
@@ -9,6 +9,7 @@ from typing import Tuple
from urllib.parse import urlparse
from utility import formatting
+from wqflask.access_roles import DataRole, AdminRole
from wqflask.resource_manager import resource_management
from wqflask.metadata_edits import metadata_edit
@@ -70,6 +71,16 @@ def before_request():
g.request_time = lambda: "%.5fs" % (time.time() - g.request_start_time)
+@app.context_processor
+def include_admin_role_class():
+ return {'AdminRole': AdminRole}
+
+
+@app.context_processor
+def include_data_role_class():
+ return {'DataRole': DataRole}
+
+
from wqflask.api import router
from wqflask import group_manager
from wqflask import resource_manager
diff --git a/wqflask/wqflask/resource_manager.py b/wqflask/wqflask/resource_manager.py
index 3371e59d..e338a22d 100644
--- a/wqflask/wqflask/resource_manager.py
+++ b/wqflask/wqflask/resource_manager.py
@@ -147,8 +147,7 @@ def view_resource(resource_id: str):
access_role=get_user_access_roles(
resource_id=resource_id,
user_id=user_id,
- gn_proxy_url=current_app.config.get("GN2_PROXY")),
- DataRole=DataRole, AdminRole=AdminRole)
+ gn_proxy_url=current_app.config.get("GN2_PROXY")))
@resource_management.route("/resources/<resource_id>/make-public",