from ..entity_table.t_auth_rule import AuthRule as AuthRule

class PermissionEngine:
    """Casbin 异步权限引擎的线程安全单例管理器"""
    def __new__(cls): ...
    async def load(self) -> None: ...
    async def rebuild(self) -> None: ...
    async def save(self) -> None: ...
    async def check_table(self) -> None:
        """检查并按需重建权限策略表。

        若配置 `AppConfig.auth.rebuild_auth_rule` 为 True：
            - 表不存在：创建表；
            - 表存在：清空现有策略（调用 `clear_policy()` 并保存空策略）。

        适用于开发/测试环境重置权限规则。
        """
    async def set_role_policy(self, role, obj, act) -> None: ...
    async def set_inherit_role(self, *, p_role, c_role) -> None: ...
    async def set_user_role(self, *, user, role) -> None: ...
    async def has_role(self, user, role): ...
    def has_permission(self, user, obj, act): ...
    def add_policy(self, p_sub, p_obj, p_act) -> None: ...
    async def close(self) -> None:
        """释放权限引擎占用的资源"""
