From 533424c9fe2049781810e3ab9560f9ab38fa55c8 Mon Sep 17 00:00:00 2001 From: wren <“porlong@qq.com”> Date: Mon, 25 May 2026 10:47:55 +0800 Subject: [PATCH] fix(rbac): treat govdoc root as frontend route set --- .../services/impl/rbacServiceImpl.py | 1 + tests/test_govdoc_permissions.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/fastapi_modules/fastapi_leaudit/services/impl/rbacServiceImpl.py b/fastapi_modules/fastapi_leaudit/services/impl/rbacServiceImpl.py index 0565b0e..5abf423 100644 --- a/fastapi_modules/fastapi_leaudit/services/impl/rbacServiceImpl.py +++ b/fastapi_modules/fastapi_leaudit/services/impl/rbacServiceImpl.py @@ -849,6 +849,7 @@ class RbacServiceImpl(IRbacService): "/chat-with-llm", "/contract-template", "/cross-checking", + "/govdoc", } return any(path in frontendPaths for path in expected) diff --git a/tests/test_govdoc_permissions.py b/tests/test_govdoc_permissions.py index 2d4200d..c264562 100644 --- a/tests/test_govdoc_permissions.py +++ b/tests/test_govdoc_permissions.py @@ -4,6 +4,8 @@ import pytest from starlette.responses import JSONResponse from fastapi_modules.fastapi_leaudit.controllers.govdocController import GovdocController +from fastapi_modules.fastapi_leaudit.domian.vo.rbacVo import RbacRouteVO +from fastapi_modules.fastapi_leaudit.services.impl.rbacServiceImpl import RbacServiceImpl class _DenyPermissionService: @@ -126,3 +128,20 @@ async def test_govdoc_list_calls_service_when_permission_granted(): assert response.data["total"] == 0 assert service.list_called is True + + +def test_govdoc_root_route_marks_frontend_route_set_ready(): + """只有内部公文模块路由时也视为新版路由,避免兼容菜单补出列表和上传。""" + service = RbacServiceImpl() + routes = [ + RbacRouteVO( + id=1, + route_path="/govdoc", + route_name="govdoc", + component="govdoc", + parent_id=None, + route_title="内部公文处理", + ) + ] + + assert service._isFrontendRouteSetReady(routes) is True