app.auth.scopes.system_scopes module
- class app.auth.scopes.system_scopes.Role(*, name: str, privilege: Annotated[int, Gt(gt=0)], permissions: List[str] | None)[source]
Bases:
BaseModel
Represents a role within a scope, defining its name, privilege level, and permissions.
- Parameters:
name (str) – The unique name of the role.
privilege (int) – The privilege level of the role, must be greater than zero.
permissions (Optional[List[str]]) – Optional list of permissions assigned to this role.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- permissions: List[str] | None
- privilege: int
- class app.auth.scopes.system_scopes.Scope(*, name: str, roles: List[Role] = [])[source]
Bases:
BaseModel
Defines a scope which contains multiple roles.
- Parameters:
name (str) – The name of the scope.
roles (List[Role]) – A list of roles defined within this scope.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- class app.auth.scopes.system_scopes.SystemScopes(*, scopes: List[Scope])[source]
Bases:
BaseModel
Container for all defined scopes in the system.
- Parameters:
scopes (List[Scope]) – A list of all scopes available.
- classmethod from_yaml_config(path: str)[source]
Create an instance from a YAML configuration file.
- Parameters:
path (str) – Path to YAML configuration file.
- Returns:
An instance of the class initialized with the parsed configuration.
- Return type:
PermissionHandler
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].