feat: add tenant-scoped rule and permission management

This commit is contained in:
wren
2026-05-21 22:03:08 +08:00
parent a2c2bf1969
commit 1f1bccf3b3
193 changed files with 64463 additions and 1771 deletions
@@ -15,17 +15,17 @@ class IRuleService(ABC):
"""规则服务接口。"""
@abstractmethod
async def ListSets(self) -> list[RuleSetVO]:
async def ListSets(self, CurrentUserId: int | None = None) -> list[RuleSetVO]:
"""列出所有规则集。"""
...
@abstractmethod
async def GetVersions(self, RuleType: str) -> list[RuleVersionVO]:
async def GetVersions(self, RuleType: str, CurrentUserId: int | None = None) -> list[RuleVersionVO]:
"""获取规则集的所有版本。"""
...
@abstractmethod
async def GetContent(self, VersionId: int) -> RuleContentVO:
async def GetContent(self, VersionId: int, CurrentUserId: int | None = None) -> RuleContentVO:
"""获取指定版本的规则正文。"""
...
@@ -41,6 +41,7 @@ class IRuleService(ABC):
YamlText: str,
ChangeNote: str | None = None,
EditorUserId: int | None = None,
CurrentUserId: int | None = None,
) -> RuleVersionVO:
"""创建规则版本。"""
...
@@ -51,6 +52,7 @@ class IRuleService(ABC):
RuleType: str,
VersionId: int,
OperatorUserId: int | None = None,
CurrentUserId: int | None = None,
) -> RuleVersionVO:
"""发布指定版本。"""
...
@@ -61,13 +63,19 @@ class IRuleService(ABC):
RuleType: str,
VersionId: int,
OperatorUserId: int | None = None,
CurrentUserId: int | None = None,
) -> RuleVersionVO:
"""回滚到指定历史版本。"""
...
@abstractmethod
async def ListBindings(self, RuleType: str | None = None, Region: str | None = None) -> list[RuleBindingVO]:
"""列出规则类型绑定。可按规则类型/地区过滤。"""
async def ListBindings(
self,
RuleType: str | None = None,
Region: str | None = None,
CurrentUserId: int | None = None,
) -> list[RuleBindingVO]:
"""列出规则类型绑定;Region 仅保留兼容入参,不再作为新链路边界。"""
...
@abstractmethod
@@ -75,13 +83,14 @@ class IRuleService(ABC):
self,
DocTypeId: int,
RuleSetId: int,
Region: str = "default",
Region: str = "公共",
BindingMode: str = "explicit",
Priority: int = 0,
DocTypeCode: str | None = None,
Note: str | None = None,
CurrentUserId: int | None = None,
) -> RuleBindingVO:
"""创建规则类型绑定。"""
"""创建规则类型绑定;新链路按二级分组生效,Region 仅兼容保留"""
...
@abstractmethod
@@ -92,11 +101,12 @@ class IRuleService(ABC):
Priority: int | None = None,
BindingMode: str | None = None,
Note: str | None = None,
CurrentUserId: int | None = None,
) -> RuleBindingVO:
"""更新规则类型绑定。"""
...
@abstractmethod
async def DeleteBinding(self, BindingId: int) -> None:
async def DeleteBinding(self, BindingId: int, CurrentUserId: int | None = None) -> None:
"""删除规则类型绑定。"""
...