UserInfo¶
- pydantic model controller.models.v1.lab.UserInfo¶
Metadata about the user who owns the lab.
- Parameters:
data (
Any
)
Show JSON schema
{ "title": "UserInfo", "description": "Metadata about the user who owns the lab.", "type": "object", "properties": { "username": { "description": "Username of the owner of this lab", "examples": [ "ribbon" ], "pattern": "^[a-z0-9](?:[a-z0-9]|-[a-z0-9])*[a-z](?:[a-z0-9]|-[a-z0-9])*$", "title": "Username", "type": "string" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Preferred human-readable name for the user. May contain spaces, capital letters, and non-ASCII Unicode characters. Should be the user's preferred representation of their name to other humans.", "examples": [ "Ribbon" ], "title": "Display name for user" }, "uid": { "description": "POSIX numeric UID for the user as a 32-bit unsigned integer", "examples": [ 1104 ], "title": "Numeric UID", "type": "integer" }, "gid": { "description": "POSIX numeric GID for user's primary group as a 32-bit unsigned integer", "examples": [ 1104 ], "title": "Numeric GID of primary group", "type": "integer" }, "groups": { "default": [], "description": "All POSIX group memberships of the user with associated GIDs, used to set the user's supplemental groups", "items": { "$ref": "#/$defs/UserGroup" }, "title": "User's group memberships", "type": "array" } }, "$defs": { "UserGroup": { "description": "Gafaelfawr's representation of a single group.", "properties": { "name": { "description": "Should follow Unix naming conventions", "examples": [ "ferrymen" ], "pattern": "^[a-zA-Z][a-zA-Z0-9._-]*$", "title": "Group to which lab user belongs", "type": "string" }, "id": { "description": "32-bit unsigned integer", "examples": [ 2023 ], "title": "Numeric GID of the group (POSIX)", "type": "integer" } }, "required": [ "name", "id" ], "title": "UserGroup", "type": "object" } }, "required": [ "username", "uid", "gid" ] }
- Fields:
- field gid: Annotated[int, Field(title='Numeric GID of primary group', description="POSIX numeric GID for user's primary group as a 32-bit unsigned integer", examples=[1104])] [Required]¶
POSIX numeric GID for user’s primary group as a 32-bit unsigned integer
- field groups: Annotated[list[UserGroup], Field(title="User's group memberships", description="All POSIX group memberships of the user with associated GIDs, used to set the user's supplemental groups")] = []¶
All POSIX group memberships of the user with associated GIDs, used to set the user’s supplemental groups
- field name: Annotated[str | None, Field(title='Display name for user', description="Preferred human-readable name for the user. May contain spaces, capital letters, and non-ASCII Unicode characters. Should be the user's preferred representation of their name to other humans.", examples=['Ribbon'])] = None¶
Preferred human-readable name for the user. May contain spaces, capital letters, and non-ASCII Unicode characters. Should be the user’s preferred representation of their name to other humans.
- field uid: Annotated[int, Field(title='Numeric UID', description='POSIX numeric UID for the user as a 32-bit unsigned integer', examples=[1104])] [Required]¶
POSIX numeric UID for the user as a 32-bit unsigned integer
- field username: Annotated[str, Field(title='Username', description='Username of the owner of this lab', examples=['ribbon'], pattern=USERNAME_REGEX)] [Required]¶
Username of the owner of this lab
- Constraints:
pattern = ^[a-z0-9](?:[a-z0-9]|-[a-z0-9])*[a-z](?:[a-z0-9]|-[a-z0-9])*$
- classmethod from_gafaelfawr(user)¶
Convert Gafaelfawr’s user metadata model to this model.
Groups without GIDs will be ignored, since they cannot be used by the lab spawner to set supplemental groups and cannot be referenced in the lab
/etc/group
file.- Parameters:
user (
GafaelfawrUserInfo
) – Gafaelfawr user metadata.- Returns:
User information stored as part of the lab state.
- Return type: