From bb2d80af509c0697eebe5ced23de99345135dc6b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 20 Jan 2023 11:56:52 +0300 Subject: oauth2: Add user-profile template and dummy endpoints * wqflask/wqflask/oauth2/routes.py: add some dummy endpoints to be fleshed out * wqflask/wqflask/templates/oauth2/view-user.html: Add missing template for the /user-profile endpoint --- wqflask/wqflask/oauth2/routes.py | 10 +++ wqflask/wqflask/templates/oauth2/view-user.html | 110 ++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 wqflask/wqflask/templates/oauth2/view-user.html diff --git a/wqflask/wqflask/oauth2/routes.py b/wqflask/wqflask/oauth2/routes.py index 4ab1f9c6..4ba94025 100644 --- a/wqflask/wqflask/oauth2/routes.py +++ b/wqflask/wqflask/oauth2/routes.py @@ -130,3 +130,13 @@ def user_profile(): return render_template( "oauth2/view-user.html", user_details=user_details, roles=roles, resources=resources) + +@oauth2.route("/request-add-to-group") +@require_oauth2 +def request_add_to_group(): + return "WOULD SEND MESSAGE TO HAVE YOU ADDED TO GROUP..." + +@oauth2.route("/create-group") +@require_oauth2 +def create_group(): + return "WOULD CREATE A NEW GROUP..." diff --git a/wqflask/wqflask/templates/oauth2/view-user.html b/wqflask/wqflask/templates/oauth2/view-user.html new file mode 100644 index 00000000..5415ba6e --- /dev/null +++ b/wqflask/wqflask/templates/oauth2/view-user.html @@ -0,0 +1,110 @@ +{%extends "base.html"%} +{%block title%}View User{%endblock%} +{%block content%} +
Name: {{user_details.name}}
+E-Mail: {{user_details.email}}
+ {%if user_details.group%} +Group:{{user_details.group}}
+ {%else%} ++ + + User is not a member of a group. +
+ +You can
+ + + +or
+ + + {%endif%} + {%else%} +No details found.
+ {%endif%} +The user has access to the following resources:
+ {%for resource in resources %} + {{role}} + {%else%} ++ + + The user has no access to any resource. + +
+ {%endfor%} ++ + No roles attached to this user +
+ {%endfor%} +