aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-02-02 12:04:39 +0300
committerFrederick Muriuki Muriithi2023-02-02 12:04:39 +0300
commitceaefbd3022044f13ba2d763598460b83bfa19ee (patch)
tree88af7326564493a8e98c2cf115bbd2f64397cbda
parent3b142f08f55d71fd3df6307420f46b1c0ba2bddb (diff)
downloadgenenetwork2-ceaefbd3022044f13ba2d763598460b83bfa19ee.tar.gz
oauth2: Update endpoints to the API server
The endpoints to the GN3 API server changed in a recent update, necessitating this commit to update the endpoints.
-rw-r--r--wqflask/wqflask/oauth2/groups.py13
-rw-r--r--wqflask/wqflask/oauth2/resources.py2
-rw-r--r--wqflask/wqflask/oauth2/roles.py4
-rw-r--r--wqflask/wqflask/oauth2/toplevel.py2
-rw-r--r--wqflask/wqflask/oauth2/users.py2
5 files changed, 12 insertions, 11 deletions
diff --git a/wqflask/wqflask/oauth2/groups.py b/wqflask/wqflask/oauth2/groups.py
index e04f6ef8..4d0bc4f5 100644
--- a/wqflask/wqflask/oauth2/groups.py
+++ b/wqflask/wqflask/oauth2/groups.py
@@ -4,7 +4,8 @@ from flask import (
from .checks import require_oauth2
from .client import oauth2_get, oauth2_post
from .request_utils import (
- user_details, handle_error, request_error, handle_success)
+ user_details, handle_error, request_error, handle_success,
+ raise_unimplemented)
groups = Blueprint("group", __name__)
@@ -21,14 +22,14 @@ def user_group():
return error.json()
def __success__(group):
- return oauth2_get(f"oauth2/group-users/{group['group_id']}").either(
+ return oauth2_get(f"oauth2/group/members/{group['group_id']}").either(
lambda error: render_template(
"oauth2/group.html", group=group,
user_error=__process_error__(error)),
lambda users: render_template(
"oauth2/group.html", group=group, users=users))
- return oauth2_get("oauth2/user-group").either(
+ return oauth2_get("oauth2/user/group").either(
request_error, __success__)
@groups.route("/create", methods=["POST"])
@@ -37,7 +38,7 @@ def create_group():
def __setup_group__(response):
session["user_details"]["group"] = response
- resp = oauth2_post("oauth2/create-group", data=dict(request.form))
+ resp = oauth2_post("oauth2/group/create", data=dict(request.form))
return resp.either(
handle_error("oauth2.group.join_or_create"),
handle_success(
@@ -51,8 +52,8 @@ def join_or_create():
if bool(usr_dets["group"]):
flash("You are already a member of a group.", "alert-info")
return redirect(url_for("oauth2.user.user_profile"))
- groups = oauth2_get("oauth2/groups").either(
- lambda x: __raise_unimplemented__(), lambda x: x)
+ groups = oauth2_get("oauth2/group/list").either(
+ lambda x: raise_unimplemented(), lambda x: x)
return render_template("oauth2/group_join_or_create.html", groups=groups)
@groups.route("/delete/<uuid:group_id>", methods=["GET", "POST"])
diff --git a/wqflask/wqflask/oauth2/resources.py b/wqflask/wqflask/oauth2/resources.py
index be814314..be3e1622 100644
--- a/wqflask/wqflask/oauth2/resources.py
+++ b/wqflask/wqflask/oauth2/resources.py
@@ -15,7 +15,7 @@ def user_resources():
def __success__(resources):
return render_template("oauth2/resources.html", resources=resources)
- return oauth2_get("oauth2/user-resources").either(
+ return oauth2_get("oauth2/user/resources").either(
request_error, __success__)
@resources.route("/create", methods=["GET"])
diff --git a/wqflask/wqflask/oauth2/roles.py b/wqflask/wqflask/oauth2/roles.py
index 8a57cee8..0b181264 100644
--- a/wqflask/wqflask/oauth2/roles.py
+++ b/wqflask/wqflask/oauth2/roles.py
@@ -15,7 +15,7 @@ def user_roles():
def __success__(roles):
return render_template("oauth2/list_roles.html", roles=roles)
- return oauth2_get("oauth2/user-roles").either(
+ return oauth2_get("oauth2/user/roles").either(
request_error, __success__)
@roles.route("/role/<uuid:role_id>", methods=["GET"])
@@ -24,5 +24,5 @@ def role(role_id: uuid.UUID):
def __success__(the_role):
return render_template("oauth2/role.html", role=the_role)
- return oauth2_get(f"oauth2/role/{role_id}").either(
+ return oauth2_get(f"oauth2/role/view/{role_id}").either(
request_error, __success__)
diff --git a/wqflask/wqflask/oauth2/toplevel.py b/wqflask/wqflask/oauth2/toplevel.py
index 68ddac13..72933861 100644
--- a/wqflask/wqflask/oauth2/toplevel.py
+++ b/wqflask/wqflask/oauth2/toplevel.py
@@ -70,7 +70,7 @@ def register_user():
config = app.config
form = request.form
response = requests.post(
- urljoin(config["GN_SERVER_URL"], "oauth2/register-user"),
+ urljoin(config["GN_SERVER_URL"], "oauth2/user/register"),
data = {
"user_name": form.get("user_name"),
"email": form.get("email_address"),
diff --git a/wqflask/wqflask/oauth2/users.py b/wqflask/wqflask/oauth2/users.py
index 1b2214eb..4b267c9f 100644
--- a/wqflask/wqflask/oauth2/users.py
+++ b/wqflask/wqflask/oauth2/users.py
@@ -13,7 +13,7 @@ def user_profile():
usr_dets = user_details()
client = oauth2_client()
- roles = oauth2_get("oauth2/user-roles").either(lambda x: "Error", lambda x: x)
+ roles = oauth2_get("oauth2/user/roles").either(lambda x: "Error", lambda x: x)
return render_template(
"oauth2/view-user.html", user_details=usr_dets, roles=roles)