Allow approvers and editors to see the audit log (package events only)

This commit is contained in:
rubenwardy
2025-09-23 17:59:45 +01:00
parent feeed21b94
commit b88cc1366f
4 changed files with 9 additions and 6 deletions

View File

@@ -35,7 +35,7 @@ class AuditForm(FlaskForm):
@bp.route("/admin/audit/")
@rank_required(UserRank.MODERATOR)
@rank_required(UserRank.APPROVER)
def audit():
page = get_int_or_abort(request.args.get("page"), 1)
num = min(40, get_int_or_abort(request.args.get("n"), 100))
@@ -56,6 +56,9 @@ def audit():
if url:
query = query.filter(AuditLogEntry.url.ilike(f"%{url}%"))
if not current_user.rank.at_least(UserRank.MODERATOR):
query = query.filter(AuditLogEntry.package)
pagination = query.paginate(page=page, per_page=num)
return render_template("admin/audit.html", log=pagination.items, pagination=pagination, form=form)