Coverage for src/lexigram/admin/rbac/types.py: 100%
11 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:26 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:26 +0800
1"""Core types for the RBAC system."""
3from __future__ import annotations
5from dataclasses import dataclass
6from typing import Any, Protocol, runtime_checkable
9@dataclass(frozen=True)
10class PolicyContext:
11 """Context passed to policy evaluators."""
13 user: Any
14 resource_name: str
15 action: str
16 record: Any | None = None # For record-level/RLS policies
19@runtime_checkable
20class Policy(Protocol):
21 """Protocol for policy evaluators."""
23 def __call__(self, context: PolicyContext) -> bool: ...