From aa2815b5ccafd7963091604bc9123e79ed19525a Mon Sep 17 00:00:00 2001 From: wangfq Date: Thu, 11 Jun 2026 17:32:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20analyst=20=E8=AE=BF=E9=97=AE=E5=8F=97?= =?UTF-8?q?=E9=99=90=E9=A1=B5=E9=9D=A2=E6=97=B6=E8=87=AA=E5=8A=A8=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE=E9=A1=B5?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E6=98=BE=E7=A4=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- edc-web/app/auth.py | 3 ++- edc-web/app/templates/test_data.html | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/edc-web/app/auth.py b/edc-web/app/auth.py index 969c2a7..b7d82ae 100644 --- a/edc-web/app/auth.py +++ b/edc-web/app/auth.py @@ -57,7 +57,8 @@ def init_auth(app): if current_user.is_authenticated and current_user.role == "analyst": ep = request.endpoint or "" if ep not in ANALYST_ALLOWED and not ep.startswith("static"): - return "权限不足:当前角色为 analyst,仅可访问测试数据", 403 + flash("当前角色为 analyst,仅可访问测试数据") + return redirect(url_for("test_data.test_data_page")) # ─── 装饰器 ──────────────────────────────────────────────────────── diff --git a/edc-web/app/templates/test_data.html b/edc-web/app/templates/test_data.html index f346bc6..ad8c995 100644 --- a/edc-web/app/templates/test_data.html +++ b/edc-web/app/templates/test_data.html @@ -4,6 +4,14 @@ {% block content %}

测试信息

+{% with messages = get_flashed_messages() %} +{% if messages %} +
+ {% for msg in messages %}{{ msg }}{% endfor %} +
+{% endif %} +{% endwith %} +