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": {
               "description": "32-bit unsigned integer",
               "examples": [
                  2023
               ],
               "title": "Numeric GID of the group (POSIX)",
               "type": "integer"
            }
         },
         "required": [
            "name",
            "id"
         ],
         "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: Annotated[int, Field(examples=[1104], title="Numeric GID for user's primary group (POSIX)", description='32-bit unsigned integer')] [Required]

32-bit unsigned integer

field groups: Annotated[list[UserGroup], Field(title="User's group memberships")] = []
field name: Annotated[str | None, Field(examples=['Ribbon'], title='Human-friendly display name for user', description="May contain spaces, capital letters, and non-ASCII characters. Should be the user's preferred representation of their name to other humans.")] = 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: Annotated[UserQuota | None, Field(title="User's quotas")] = None
field token: Annotated[str, Field(title='Notebook token')] [Required]
field uid: Annotated[int, Field(examples=[1104], title='Numeric UID for user (POSIX)', description='32-bit unsigned integer')] [Required]

32-bit unsigned integer

field username: Annotated[str, Field(examples=['ribbon'], title='Username for Lab user', pattern=USERNAME_REGEX)] [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.

Return type:

str

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.

Return type:

dict[str, str]

property supplemental_groups: list[int]

Supplemental GIDs.