buildgrid.server.auth.config module

class buildgrid.server.auth.config.Acl(*, actor: str | None = None, requests: List[str] | None = None, subject: str | None = None, workflow: str | None = None)

Bases: BaseModel

actor: str | None
requests: List[str] | None
subject: str | None
workflow: str | None
is_authorized(request_name: str, actor: str | None = None, subject: str | None = None, workflow: str | None = None) bool
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'actor': FieldInfo(annotation=Union[str, NoneType], required=False), 'requests': FieldInfo(annotation=Union[List[str], NoneType], required=False), 'subject': FieldInfo(annotation=Union[str, NoneType], required=False), 'workflow': FieldInfo(annotation=Union[str, NoneType], required=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class buildgrid.server.auth.config.InstanceAuthorizationConfig(*, allow: Literal['all'] | List[Acl])

Bases: BaseModel

allow: Literal['all'] | List[Acl]
is_authorized(request_name: str, actor: str | None = None, subject: str | None = None, workflow: str | None = None) bool
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'allow': FieldInfo(annotation=Union[Literal['all'], List[buildgrid.server.auth.config.Acl]], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

buildgrid.server.auth.config.parse_auth_config(path: str | bytes | os.PathLike[str]) Dict[str, InstanceAuthorizationConfig]