fix(rules): unify rule configuration naming
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
"""规则管理控制器。"""
|
"""规则配置控制器。"""
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -30,10 +30,10 @@ from fastapi_modules.fastapi_leaudit.services.permissionService import IPermissi
|
|||||||
|
|
||||||
|
|
||||||
class RuleController(BaseController):
|
class RuleController(BaseController):
|
||||||
"""规则管理控制器。"""
|
"""规则配置控制器。"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(prefix="/rule-sets", tags=["规则管理"])
|
super().__init__(prefix="/rule-sets", tags=["规则配置"])
|
||||||
self.RuleService: IRuleService = GetRuleServiceSingleton()
|
self.RuleService: IRuleService = GetRuleServiceSingleton()
|
||||||
self.PermissionService: IPermissionService = PermissionServiceImpl()
|
self.PermissionService: IPermissionService = PermissionServiceImpl()
|
||||||
self._PERMISSIONS = {
|
self._PERMISSIONS = {
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ class RbacAdminServiceImpl(IRbacAdminService):
|
|||||||
"route_path": "/rules",
|
"route_path": "/rules",
|
||||||
"route_name": "rule-management",
|
"route_name": "rule-management",
|
||||||
"component": "rules",
|
"component": "rules",
|
||||||
"route_title": "规则管理",
|
"route_title": "规则配置",
|
||||||
"icon": "ri-book-3-line",
|
"icon": "ri-book-3-line",
|
||||||
"sort_order": 70,
|
"sort_order": 70,
|
||||||
"is_hidden": False,
|
"is_hidden": False,
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class RbacServiceImpl(IRbacService):
|
|||||||
"route_name": "rule-management",
|
"route_name": "rule-management",
|
||||||
"component": "rules",
|
"component": "rules",
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"route_title": "规则管理",
|
"route_title": "规则配置",
|
||||||
"icon": "ri-book-3-line",
|
"icon": "ri-book-3-line",
|
||||||
"sort_order": 5,
|
"sort_order": 5,
|
||||||
"is_hidden": False,
|
"is_hidden": False,
|
||||||
@@ -489,7 +489,7 @@ class RbacServiceImpl(IRbacService):
|
|||||||
"route_name": "rule-management",
|
"route_name": "rule-management",
|
||||||
"component": "rules",
|
"component": "rules",
|
||||||
"parent_id": None,
|
"parent_id": None,
|
||||||
"route_title": "规则管理",
|
"route_title": "规则配置",
|
||||||
"icon": "ri-book-3-line",
|
"icon": "ri-book-3-line",
|
||||||
"sort_order": 5,
|
"sort_order": 5,
|
||||||
"is_hidden": False,
|
"is_hidden": False,
|
||||||
|
|||||||
+1
-1
Submodule legal-platform-frontend updated: fe2b82bda3...469de25dc8
@@ -102,7 +102,7 @@ seed(role_key, permission_key, grant_type, data_scope) AS (
|
|||||||
('provincial_admin', 'govdoc:settings:read', 'GRANT', 'ALL'),
|
('provincial_admin', 'govdoc:settings:read', 'GRANT', 'ALL'),
|
||||||
('provincial_admin', 'govdoc:settings:update', 'GRANT', 'ALL'),
|
('provincial_admin', 'govdoc:settings:update', 'GRANT', 'ALL'),
|
||||||
|
|
||||||
-- admin: 模块读写 + 规则查看,不含规则管理与配置修改
|
-- admin: 模块读写 + 规则查看,不含规则配置与配置修改
|
||||||
('admin', 'govdoc:module:read', 'GRANT', 'REGION'),
|
('admin', 'govdoc:module:read', 'GRANT', 'REGION'),
|
||||||
('admin', 'govdoc:document:create', 'GRANT', 'REGION'),
|
('admin', 'govdoc:document:create', 'GRANT', 'REGION'),
|
||||||
('admin', 'govdoc:document:read', 'GRANT', 'REGION'),
|
('admin', 'govdoc:document:read', 'GRANT', 'REGION'),
|
||||||
@@ -135,4 +135,4 @@ ON CONFLICT (role_id, permission_id) DO UPDATE SET
|
|||||||
data_scope = EXCLUDED.data_scope,
|
data_scope = EXCLUDED.data_scope,
|
||||||
updated_at = NOW();
|
updated_at = NOW();
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ VALUES
|
|||||||
('/documents/list', 'documents.list', 'documents/list', NULL, '文档列表', 'table', 11, FALSE, TRUE, '{"group":"documents"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
('/documents/list', 'documents.list', 'documents/list', NULL, '文档列表', 'table', 11, FALSE, TRUE, '{"group":"documents"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
||||||
('/audit', 'audit', 'Layout', NULL, '评查任务', 'audit', 20, FALSE, TRUE, '{"group":"audit"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
('/audit', 'audit', 'Layout', NULL, '评查任务', 'audit', 20, FALSE, TRUE, '{"group":"audit"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
||||||
('/audit/runs', 'audit.runs', 'audit/runs', NULL, '评查运行', 'history', 21, FALSE, TRUE, '{"group":"audit"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
('/audit/runs', 'audit.runs', 'audit/runs', NULL, '评查运行', 'history', 21, FALSE, TRUE, '{"group":"audit"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
||||||
('/rules', 'rules', 'Layout', NULL, '规则管理', 'rule', 30, FALSE, TRUE, '{"group":"rules"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
('/rules', 'rules', 'Layout', NULL, '规则配置', 'rule', 30, FALSE, TRUE, '{"group":"rules"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
||||||
('/system', 'system', 'Layout', NULL, '系统管理', 'setting', 90, FALSE, TRUE, '{"group":"system"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
('/system', 'system', 'Layout', NULL, '系统管理', 'setting', 90, FALSE, TRUE, '{"group":"system"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
||||||
('/system/users', 'system.users', 'system/users', NULL, '用户管理', 'user', 91, FALSE, TRUE, '{"group":"system"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
('/system/users', 'system.users', 'system/users', NULL, '用户管理', 'user', 91, FALSE, TRUE, '{"group":"system"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
||||||
('/system/roles', 'system.roles', 'system/roles', NULL, '角色权限', 'shield', 92, FALSE, TRUE, '{"group":"system"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
('/system/roles', 'system.roles', 'system/roles', NULL, '角色权限', 'shield', 92, FALSE, TRUE, '{"group":"system"}'::jsonb, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
"""首页入口可见性测试。"""
|
"""首页入口可见性测试。"""
|
||||||
|
|
||||||
|
from fastapi_modules.fastapi_leaudit.services.impl.entryModuleAdminServiceImpl import EntryModuleAdminServiceImpl
|
||||||
from fastapi_modules.fastapi_leaudit.services.impl.homeServiceImpl import HomeServiceImpl
|
from fastapi_modules.fastapi_leaudit.services.impl.homeServiceImpl import HomeServiceImpl
|
||||||
|
from fastapi_modules.fastapi_leaudit.services.impl.rbacServiceImpl import RbacServiceImpl
|
||||||
|
|
||||||
|
|
||||||
def test_document_entry_targets_are_visible_without_file_management_routes():
|
def test_document_entry_targets_are_visible_without_file_management_routes():
|
||||||
@@ -19,3 +21,28 @@ def test_non_document_entry_targets_still_require_route_grant():
|
|||||||
assert service._isAllowedTargetPath("/tenants", set()) is False
|
assert service._isAllowedTargetPath("/tenants", set()) is False
|
||||||
assert service._isAllowedTargetPath("/cross-checking", set()) is False
|
assert service._isAllowedTargetPath("/cross-checking", set()) is False
|
||||||
assert service._isAllowedTargetPath("/cross-checking", {"/cross-checking"}) is True
|
assert service._isAllowedTargetPath("/cross-checking", {"/cross-checking"}) is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_govdoc_home_features_use_rule_config_for_legacy_rule_groups():
|
||||||
|
"""内部公文旧规则分组功能编码应兼容到规则配置。"""
|
||||||
|
service = HomeServiceImpl()
|
||||||
|
|
||||||
|
assert service._parseFeatures(["home", "rule_groups"], "govdoc") == ["home", "rules"]
|
||||||
|
assert service._parseFeatures([], "govdoc") == ["home", "govdoc_audits", "govdoc_upload", "rules"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_govdoc_admin_features_use_rule_config_for_legacy_rule_groups():
|
||||||
|
"""入口模块管理读写内部公文功能时兼容旧规则分组编码。"""
|
||||||
|
service = EntryModuleAdminServiceImpl()
|
||||||
|
|
||||||
|
assert service._parseFeatures(["home", "rule_groups"], "govdoc") == ["home", "rules"]
|
||||||
|
assert service._normalizeFeatures(["rule_groups"], "govdoc") == ["rules"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_rbac_compat_routes_use_rule_config_title():
|
||||||
|
"""RBAC 兼容菜单里的 /rules 标题统一为规则配置。"""
|
||||||
|
service = RbacServiceImpl()
|
||||||
|
routes = service._buildCompatibilityRoutes(["admin"], {"rules:list:read"})
|
||||||
|
rules_route = next(route for route in routes if route.route_path == "/rules")
|
||||||
|
|
||||||
|
assert rules_route.route_title == "规则配置"
|
||||||
|
|||||||
Reference in New Issue
Block a user