aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/oauth2/groups.py17
-rw-r--r--wqflask/wqflask/oauth2/resources.py30
-rw-r--r--wqflask/wqflask/templates/oauth2/group.html23
-rw-r--r--wqflask/wqflask/templates/oauth2/resources.html10
4 files changed, 76 insertions, 4 deletions
diff --git a/wqflask/wqflask/oauth2/groups.py b/wqflask/wqflask/oauth2/groups.py
index 0bd40044..d04509df 100644
--- a/wqflask/wqflask/oauth2/groups.py
+++ b/wqflask/wqflask/oauth2/groups.py
@@ -37,3 +37,20 @@ def group_join_or_create():
groups = oauth2_get("oauth2/groups").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"])
+@require_oauth2
+def delete_group(group_id):
+ """Delete the user's group."""
+ return "WOULD DELETE GROUP."
+
+@groups.route("/edit/<uuid:group_id>", methods=["GET", "POST"])
+@require_oauth2
+def edit_group(group_id):
+ """Edit the user's group."""
+ return "WOULD EDIT GROUP."
+
+@groups.route("/<uuid:group_id>/users/list", methods=["GET", "POST"])
+@require_oauth2
+def list_group_users(group_id):
+ return "WOULD LIST GROUP USERS."
diff --git a/wqflask/wqflask/oauth2/resources.py b/wqflask/wqflask/oauth2/resources.py
index db5e1cc4..578e0414 100644
--- a/wqflask/wqflask/oauth2/resources.py
+++ b/wqflask/wqflask/oauth2/resources.py
@@ -1,3 +1,5 @@
+import uuid
+
from flask import Blueprint, render_template
from .client import oauth2_get
@@ -9,8 +11,36 @@ resources = Blueprint("resource", __name__)
@resources.route("/", methods=["GET"])
@require_oauth2
def user_resources():
+ """List the resources the user has access to."""
def __success__(resources):
return render_template("oauth2/resources.html", resources=resources)
return oauth2_get("oauth2/user-resources").either(
__request_error__, __success__)
+
+@resources.route("/create", methods=["GET"])
+@require_oauth2
+def create_resource():
+ """Create a new resource."""
+ return "WOULD CREATE A NEW RESOURCE."
+
+@resources.route("/view/<uuid:resource_id>", methods=["GET"])
+@require_oauth2
+def view_resource(resource_id: uuid.UUID):
+ """View the given resource."""
+ # Display the resource's details
+ # Provide edit/delete options
+ # Metadata edit maybe?
+ return "WOULD DISPLAY THE GIVEN RESOURCE'S DETAILS"
+
+@resources.route("/edit/<uuid:resource_id>", methods=["GET"])
+@require_oauth2
+def edit_resource(resource_id: uuid.UUID):
+ """Edit the given resource."""
+ return "WOULD Edit THE GIVEN RESOURCE'S DETAILS"
+
+@resources.route("/delete/<uuid:resource_id>", methods=["GET"])
+@require_oauth2
+def delete_resource(resource_id: uuid.UUID):
+ """Delete the given resource."""
+ return "WOULD DELETE THE GIVEN RESOURCE"
diff --git a/wqflask/wqflask/templates/oauth2/group.html b/wqflask/wqflask/templates/oauth2/group.html
index df69a573..1475b10d 100644
--- a/wqflask/wqflask/templates/oauth2/group.html
+++ b/wqflask/wqflask/templates/oauth2/group.html
@@ -3,7 +3,7 @@
{%block title%}View User{%endblock%}
{%block content%}
<div class="container" style="min-width: 1250px;">
- {{profile_nav("dashboard")}}
+ {{profile_nav("group")}}
<h3>User's Group</h3>
{{flash_me()}}
@@ -21,6 +21,27 @@
</dl>
</div>
+ <div class="row">
+ <form action="{{url_for('oauth2.group.edit_group', group_id=group.group_id)}}"
+ method="POST" style="display: inline">
+ <input type="hidden" name="group_id" value="{{group.group_id}}">
+ <input type="submit" class="btn btn-info" value="Edit" />
+ </form>
+
+ <form action="{{url_for('oauth2.group.edit_group', group_id=group.group_id)}}"
+ method="POST" style="display: inline">
+ <input type="hidden" name="group_id" value="{{group.group_id}}">
+ <input type="submit" class="btn btn-danger" value="Delete" />
+ </form>
+ </div>
+
+ {%if group%}
+ <div class="row" style="padding-top: 0.5em;">
+ <a href="{{url_for('oauth2.group.list_group_users', group_id=group.group_id)}}"
+ class="btn btn-info">Group Users</a>
+ </div>
+ {%endif%}
+
</div>
</div>
diff --git a/wqflask/wqflask/templates/oauth2/resources.html b/wqflask/wqflask/templates/oauth2/resources.html
index 38f851e6..44774fda 100644
--- a/wqflask/wqflask/templates/oauth2/resources.html
+++ b/wqflask/wqflask/templates/oauth2/resources.html
@@ -8,13 +8,17 @@
{{flash_me()}}
- {{resources}}
-
<div class="container-fluid">
+ <div class="row">
+ <a href="{{url_for('oauth2.resource.create_resource')}}"
+ class="btn btn-info" title="Create a new resource">
+ Create New Resource
+ </a>
+ </div>
<div class="row">
{%for resource in resources %}
- {{role}}
+ {{resource.resource_name}} - {{resource.resource_category}} - {{resource.group}}
{%else%}
<p>
<span class="glyphicon glyphicon-warning-sign"></span>&nbsp;