Skip to content

Permission Checker

permission_checker

Protocol for permission-checking implementations.

PermissionChecker

Bases: Protocol

Protocol for any callable that decides whether a permission is granted.

Source code in src/forging_blocks/domain/permissions/permission_checker.py
@runtime_checkable
class PermissionChecker(Protocol):
    """Protocol for any callable that decides whether a permission is granted."""

    async def check(self, context: AuthorizationContext, permission: Permission) -> bool:
        """Return ``True`` if *permission* is granted in *context*."""
        ...

check(context: AuthorizationContext, permission: Permission) -> bool async

Return True if permission is granted in context.

Source code in src/forging_blocks/domain/permissions/permission_checker.py
async def check(self, context: AuthorizationContext, permission: Permission) -> bool:
    """Return ``True`` if *permission* is granted in *context*."""
    ...