aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2021-11-08 08:57:19 +0300
committerBonfaceKilz2021-11-11 09:32:26 +0300
commit1184fa8b540b1fef205fd87e3a8f0a8a2c702d76 (patch)
tree3f51adaa199e4cee873c178c1719677d23451690 /wqflask
parentd330150c71deb27c29c29bfce8f14856e49ca157 (diff)
downloadgenenetwork2-1184fa8b540b1fef205fd87e3a8f0a8a2c702d76.tar.gz
Register "group_management" blueprint
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/__init__.py2
-rw-r--r--wqflask/wqflask/group_manager.py31
2 files changed, 33 insertions, 0 deletions
diff --git a/wqflask/wqflask/__init__.py b/wqflask/wqflask/__init__.py
index 98416b41..05e040ed 100644
--- a/wqflask/wqflask/__init__.py
+++ b/wqflask/wqflask/__init__.py
@@ -12,6 +12,7 @@ from utility import formatting
from gn3.authentication import DataRole, AdminRole
from wqflask.group_manager import group_management
+from wqflask.resource_manager import resource_management
from wqflask.metadata_edits import metadata_edit
from wqflask.api.markdown import glossary_blueprint
@@ -66,6 +67,7 @@ app.register_blueprint(jupyter_notebooks, url_prefix="/jupyter_notebooks")
app.register_blueprint(resource_management, url_prefix="/resource-management")
app.register_blueprint(metadata_edit, url_prefix="/datasets/")
+app.register_blueprint(group_management, url_prefix="/group-management")
@app.before_request
def before_request():
diff --git a/wqflask/wqflask/group_manager.py b/wqflask/wqflask/group_manager.py
index e69de29b..4edafc66 100644
--- a/wqflask/wqflask/group_manager.py
+++ b/wqflask/wqflask/group_manager.py
@@ -0,0 +1,31 @@
+import redis
+
+from flask import current_app
+from flask import Blueprint
+from flask import g
+from flask import render_template
+from gn3.authentication import get_groups_by_user_uid
+from wqflask.decorators import login_required
+
+group_management = Blueprint("group_management", __name__)
+
+
+@group_management.route("/groups")
+@login_required
+def view_groups():
+ groups = get_groups_by_user_uid(
+ user_uid=(g.user_session.record.get(b"user_id",
+ b"").decode("utf-8") or
+ g.user_session.record.get("user_id", "")),
+ conn=redis.from_url(
+ current_app.config["REDIS_URL"],
+ decode_responses=True))
+ return render_template("admin/group_manager.html",
+ admin_groups=groups.get("admin"),
+ member_groups=groups.get("member"))
+
+
+@group_management.route("/groups/create", methods=("GET",))
+@login_required
+def view_create_group_page():
+ return render_template("admin/create_group.html")