chore: initial commit — leaudit-platform project skeleton
17-table PostgreSQL schema with full Chinese column comments, FastAPI project structure (admin/common/modules), DSL rule files, and schema migration scripts.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""权限服务接口。"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class IPermissionService(ABC):
|
||||
"""权限检查服务接口。
|
||||
|
||||
权限格式:module:resource:action(如 document:list:read)
|
||||
支持通配符:document:*:*、*:*:* 等
|
||||
支持 GRANT/DENY 机制(DENY 优先级更高)
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def CheckPermission(self, UserId: int, PermissionKey: str) -> bool:
|
||||
"""检查用户是否拥有指定权限。"""
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
async def HasAnyPermission(self, UserId: int, PermissionKeys: list[str]) -> bool:
|
||||
"""检查用户是否拥有任意一个权限(OR 逻辑)。"""
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
async def HasAllPermissions(self, UserId: int, PermissionKeys: list[str]) -> bool:
|
||||
"""检查用户是否拥有所有权限(AND 逻辑)。"""
|
||||
...
|
||||
Reference in New Issue
Block a user