GafaelfawrUser¶
- pydantic model controller.models.domain.gafaelfawr.GafaelfawrUser¶
User information from Gafaelfawr supplemented with the user’s token.
This model is used to pass the user information around internally, bundling the user’s metadata with their notebook token.
- Parameters:
data (
Any
)
Show JSON schema
{ "title": "GafaelfawrUser", "description": "User information from Gafaelfawr supplemented with the user's token.\n\nThis model is used to pass the user information around internally,\nbundling the user's metadata with their notebook token.", "type": "object", "properties": { "username": { "examples": [ "ribbon" ], "pattern": "^[a-z0-9](?:[a-z0-9]|-[a-z0-9])*[a-z](?:[a-z0-9]|-[a-z0-9])*$", "title": "Username for Lab user", "type": "string" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "May contain spaces, capital letters, and non-ASCII characters. Should be the user's preferred representation of their name to other humans.", "examples": [ "Ribbon" ], "title": "Human-friendly display name for user" }, "uid": { "description": "32-bit unsigned integer", "examples": [ 1104 ], "title": "Numeric UID for user (POSIX)", "type": "integer" }, "gid": { "description": "32-bit unsigned integer", "examples": [ 1104 ], "title": "Numeric GID for user's primary group (POSIX)", "type": "integer" }, "groups": { "default": [], "items": { "$ref": "#/$defs/UserGroup" }, "title": "User's group memberships", "type": "array" }, "quota": { "anyOf": [ { "$ref": "#/$defs/UserQuota" }, { "type": "null" } ], "default": null, "title": "User's quotas" }, "token": { "title": "Notebook token", "type": "string" } }, "$defs": { "NotebookQuota": { "description": "Notebook Aspect quota information for a user.", "properties": { "cpu": { "examples": [ 4.0 ], "title": "CPU equivalents", "type": "number" }, "memory": { "examples": [ 16.0 ], "title": "Maximum memory use (GiB)", "type": "number" } }, "required": [ "cpu", "memory" ], "title": "NotebookQuota", "type": "object" }, "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": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "32-bit unsigned integer", "examples": [ 2023 ], "title": "Numeric GID of the group (POSIX)" } }, "required": [ "name" ], "title": "UserGroup", "type": "object" }, "UserQuota": { "description": "Quota information for a user.", "properties": { "api": { "additionalProperties": { "type": "integer" }, "default": {}, "description": "Mapping of service names to allowed requests per 15 minutes.", "examples": [ { "datalinker": 500, "hips": 2000, "tap": 500, "vo-cutouts": 100 } ], "title": "API quotas", "type": "object" }, "notebook": { "anyOf": [ { "$ref": "#/$defs/NotebookQuota" }, { "type": "null" } ], "default": null, "title": "Notebook Aspect quotas" } }, "title": "UserQuota", "type": "object" } }, "required": [ "username", "uid", "gid", "token" ] }
- Fields:
- field gid: int [Required]¶
32-bit unsigned integer
- field groups: list[UserGroup] = []¶
- field name: str | None = None¶
May contain spaces, capital letters, and non-ASCII characters. Should be the user’s preferred representation of their name to other humans.
- field quota: UserQuota | None = None¶
- field token: str [Required]¶
- field uid: int [Required]¶
32-bit unsigned integer
- field username: str [Required]¶
- Constraints:
pattern = ^[a-z0-9](?:[a-z0-9]|-[a-z0-9])*[a-z](?:[a-z0-9]|-[a-z0-9])*$
- groups_json()¶
Group membership serialized to JSON.
Groups without GIDs are omitted since we can’t do anything with them in the context of a user lab.
- Return type:
- to_headers()¶
Return the representation of this user as HTTP request headers.
Used primarily by the test suite for constructing authenticated requests from a user.