Skip to content

Schema permission status

Result of checking a single schema permission for a role.

Version Added

1.5.0

Source code in pum/role_manager.py
@dataclass
class SchemaPermissionStatus:
    """Result of checking a single schema permission for a role.

    Version Added:
        1.5.0
    """

    schema: str
    """Name of the schema."""
    expected: PermissionType | None
    """Expected permission type from the configuration, or ``None``."""
    has_read: bool = False
    """Whether the role currently has read-level access."""
    has_write: bool = False
    """Whether the role currently has write-level access."""

    @property
    def satisfied(self) -> bool:
        """``True`` when the actual privileges match the expected ones."""
        if self.expected == PermissionType.READ:
            return self.has_read
        if self.expected == PermissionType.WRITE:
            return self.has_write
        # No expectation – anything is fine
        return True

expected instance-attribute

expected: PermissionType | None

Expected permission type from the configuration, or None.

has_read class-attribute instance-attribute

has_read: bool = False

Whether the role currently has read-level access.

has_write class-attribute instance-attribute

has_write: bool = False

Whether the role currently has write-level access.

satisfied property

satisfied: bool

True when the actual privileges match the expected ones.

schema instance-attribute

schema: str

Name of the schema.