Files
wren 535d97a70c 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.
2026-04-27 16:48:22 +08:00

28 lines
863 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""权限服务接口。"""
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 逻辑)。"""
...