WMGZON/controllers/web/admin.py

27 lines
726 B
Python
Raw Normal View History

""" The admin controller to manage all of the admin related endpoints
2024-02-12 19:28:15 +00:00
in the web app
"""
from flask import render_template, Blueprint
from controllers.database.user import UserController
2024-02-12 19:28:15 +00:00
# Blueprint to append user endpoints to
blueprint = Blueprint("admin", __name__, url_prefix="/admin")
@blueprint.route('/')
def main():
2024-02-12 19:28:15 +00:00
""" Function responsible for delivering the admin page for the site """
return "Hello, World"
@blueprint.route('/users/')
def users():
2024-02-12 19:28:15 +00:00
""" Endpoint responsible for managing a users permissions """
# Get all users to create admin table on frontend
db = UserController()
users = db.read_all()
return render_template("index.html", content="admin.html", users=users)