forked from Github-Mirrors/canaille

The dropdown was not always displayed due to lack of 'menuitem' parameter on some calls. The 'active' and 'dropdown' classes from fomanticUI clash so the dropdown is not displayed when both are added to the `div` tag. As workaround, 'active' class is replaced by a custom 'dropdown-active' class.
29 lines
845 B
Python
29 lines
845 B
Python
from canaille.flaskutils import permissions_needed
|
|
from canaille.oidc.models import AuthorizationCode
|
|
from flask import Blueprint
|
|
from flask_themer import render_template
|
|
|
|
|
|
bp = Blueprint("authorizations", __name__, url_prefix="/admin/authorization")
|
|
|
|
|
|
@bp.route("/")
|
|
@permissions_needed("manage_oidc")
|
|
def index(user):
|
|
authorizations = AuthorizationCode.filter()
|
|
return render_template(
|
|
"oidc/admin/authorization_list.html",
|
|
authorizations=authorizations,
|
|
menuitem="admin",
|
|
)
|
|
|
|
|
|
@bp.route("/<authorization_id>", methods=["GET", "POST"])
|
|
@permissions_needed("manage_oidc")
|
|
def view(user, authorization_id):
|
|
authorization = AuthorizationCode.get(authorization_id)
|
|
return render_template(
|
|
"oidc/admin/authorization_view.html",
|
|
authorization=authorization,
|
|
menuitem="admin",
|
|
)
|