Allow admin tools page to be used by editors

This makes it easier to find certain tools
This commit is contained in:
rubenwardy
2024-01-28 21:51:31 +00:00
parent 4c5b506053
commit 50b860233b
3 changed files with 99 additions and 46 deletions

View File

@@ -28,9 +28,9 @@ from ...querybuilder import QueryBuilder
@bp.route("/admin/", methods=["GET", "POST"])
@rank_required(UserRank.ADMIN)
@rank_required(UserRank.EDITOR)
def admin_page():
if request.method == "POST":
if request.method == "POST" and current_user.rank.at_least(UserRank.ADMIN):
action = request.form["action"]
if action in actions:
ret = actions[action]["func"]()
@@ -40,8 +40,7 @@ def admin_page():
else:
flash("Unknown action: " + action, "danger")
deleted_packages = Package.query.filter(Package.state == PackageState.DELETED).all()
return render_template("admin/list.html", deleted_packages=deleted_packages, actions=actions)
return render_template("admin/list.html", actions=actions)
class SwitchUserForm(FlaskForm):