openlifu.db.user.User

class openlifu.db.user.User(id: "Annotated[str, OpenLIFUFieldData('User ID', 'The unique identifier of the user')]" = 'user', password_hash: "Annotated[str, OpenLIFUFieldData('Password hash', 'A hashed user password for authentication.')]" = '', roles: "Annotated[List[str], OpenLIFUFieldData('Roles', 'A list of roles')]" = <factory>, name: "Annotated[str, OpenLIFUFieldData('User name', 'The name of the user')]" = 'User', description: "Annotated[str, OpenLIFUFieldData('Description', 'A description of the user')]" = '')[source]

Bases: object

description: Annotated[str, OpenLIFUFieldData(name='Description', description='A description of the user')] = ''

A description of the user

static from_json(json_string: str) User[source]

Load a User from a json string

id: Annotated[str, OpenLIFUFieldData(name='User ID', description='The unique identifier of the user')] = 'user'

The unique identifier of the user

name: Annotated[str, OpenLIFUFieldData(name='User name', description='The name of the user')] = 'User'

The name of the user

password_hash: Annotated[str, OpenLIFUFieldData(name='Password hash', description='A hashed user password for authentication.')] = ''

A hashed user password for authentication.

roles: Annotated[List[str], OpenLIFUFieldData(name='Roles', description='A list of roles')]

A list of roles

to_file(filename: str)[source]

Save the user to a file

Parameters:

filename – Name of the file

to_json(compact: bool) str[source]

Serialize a User to a json string

Parameters:

compact – if enabled then the string is compact (not pretty). Disable for pretty.

Returns: A json string representing the complete User object.