8.2.10.4.11.11. User

class User(**kwargs)[source]

Methods

__delattr__

Implement delattr(self, name).

__dir__

Default dir() implementation.

__eq__

Checks the equality of two UserMixin objects using get_id.

__format__

Default object formatter.

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__getstate__

Helper for pickle.

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

A simple constructor that allows initialization from kwargs.

__init_subclass__

This method is called when a class is subclassed.

__le__

Return self<=value.

__lt__

Return self<value.

__ne__

Checks the inequality of two UserMixin objects using get_id.

__new__

__reduce__

Helper for pickle.

__reduce_ex__

Helper for pickle.

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__

Size of object in memory, in bytes.

__str__

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

augment_auth_token

Override this to add/modify parts of the auth token.

calc_username

Come up with the best 'username' based on how the app is configured (via SECURITY_USER_IDENTITY_ATTRIBUTES).

get_auth_token

Constructs the user's authentication token.

get_id

Returns the user identification attribute.

get_redirect_qparams

Return user info that will be added to redirect query params.

get_security_payload

Serialize user object as response payload.

has_permission

Returns True if user has this permission (via a role it has).

has_role

Returns True if the user identifies with the specified role.

name

tf_send_security_token

Generate and send the security code for two-factor.

us_send_security_token

Generate and send the security code for unified sign in.

verify_and_update_password

Returns True if the password is valid for the specified user.

verify_auth_token

Override this to perform additional verification of contents of auth token.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

Attributes

__abstract__

__annotations__

__dict__

__doc__

__fsa__

Internal reference to the extension object.

__mapper__

__module__

__table__

__tablename__

__weakref__

list of weak references to the object

_sa_class_manager

_sa_registry

active

avatar

confirmed_at

create_datetime

current_login_at

current_login_ip

custom_data

email

firstname

fs_uniquifier

fs_webauthn_user_handle

id

is_active

Returns True if the user is active.

is_anonymous

is_authenticated

last_login_at

last_login_ip

lastname

login_count

metadata

mf_recovery_codes

password

registry

roles

settings

tf_phone_number

tf_primary_method

tf_totp_secret

update_datetime

us_phone_number

us_totp_secrets

username

firstname
lastname
avatar
custom_data
settings
name()[source]
__repr__()[source]

Return repr(self).

get_security_payload()[source]

Serialize user object as response payload. Override this to return any/all of the user object in JSON responses. Return a dict.

__annotations__ = {'__fsa__': 't.ClassVar[SQLAlchemy]', 'active': 'bool', 'confirmed_at': 'datetime | None', 'create_datetime': 'datetime', 'current_login_at': 'datetime', 'current_login_ip': 'str | None', 'email': 'str', 'fs_token_uniquifier': 'str', 'fs_uniquifier': 'str', 'fs_webauthn_user_handle': 'str', 'id': 'int', 'last_login_at': 'datetime', 'last_login_ip': 'str | None', 'login_count': 'int', 'mf_recovery_codes': 'list[str] | None', 'password': 'str | None', 'query': 't.ClassVar[Query]', 'query_class': 't.ClassVar[type[Query]]', 'roles': 'list[RoleMixin]', 'tf_phone_number': 'str | None', 'tf_primary_method': 'str | None', 'tf_totp_secret': 'str | None', 'update_datetime': 'datetime', 'us_phone_number': 'str | None', 'us_totp_secrets': 'str | bytes | None', 'username': 'str | None', 'webauthn': 'list[WebAuthnMixin]'}
__doc__ = None
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x78ac451f31d0; User>
__module__ = 'schedula.utils.form.server.security'
__table__ = Table('user', MetaData(), Column('firstname', String(length=255), table=<user>), Column('lastname', String(length=255), table=<user>), Column('avatar', JSON(), table=<user>), Column('custom_data', JSON(), table=<user>), Column('settings', JSON(), table=<user>), Column('fs_webauthn_user_handle', String(length=64), table=<user>), Column('mf_recovery_codes', AsaList(), table=<user>), Column('password', String(length=255), table=<user>), Column('us_phone_number', String(length=128), table=<user>), Column('username', String(length=255), table=<user>), Column('us_totp_secrets', Text(), table=<user>), Column('id', Integer(), table=<user>, primary_key=True, nullable=False), Column('email', String(length=255), table=<user>, nullable=False), Column('active', Boolean(), table=<user>, nullable=False), Column('fs_uniquifier', String(length=64), table=<user>, nullable=False), Column('confirmed_at', DateTime(), table=<user>), Column('last_login_at', DateTime(), table=<user>), Column('current_login_at', DateTime(), table=<user>), Column('last_login_ip', String(length=64), table=<user>), Column('current_login_ip', String(length=64), table=<user>), Column('login_count', Integer(), table=<user>), Column('tf_primary_method', String(length=64), table=<user>), Column('tf_totp_secret', String(length=255), table=<user>), Column('tf_phone_number', String(length=128), table=<user>), Column('create_datetime', DateTime(), table=<user>, nullable=False, server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x78ac44c41f50; now>, for_update=False)), Column('update_datetime', DateTime(), table=<user>, nullable=False, onupdate=CallableColumnDefault(<function naive_utcnow>), server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x78ac44c42410; now>, for_update=False)), schema=None)
__tablename__ = 'user'
_sa_class_manager = {'active': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'avatar': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'confirmed_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'create_datetime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'current_login_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'current_login_ip': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'custom_data': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'firstname': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'fs_uniquifier': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'fs_webauthn_user_handle': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'last_login_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'last_login_ip': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'lastname': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'login_count': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'mf_recovery_codes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'roles': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'settings': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tf_phone_number': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tf_primary_method': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tf_totp_secret': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'update_datetime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'us_phone_number': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'us_totp_secrets': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'username': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
active: bool
confirmed_at: datetime | None
create_datetime: datetime
current_login_at: datetime
current_login_ip: str | None
email: str
fs_uniquifier: str
fs_webauthn_user_handle: str
id: int
last_login_at: datetime
last_login_ip: str | None
login_count: int
mf_recovery_codes: list[str] | None
password: str | None
roles: list[RoleMixin]
tf_phone_number: str | None
tf_primary_method: str | None
tf_totp_secret: str | None
update_datetime: datetime
us_phone_number: str | None
us_totp_secrets: str | bytes | None
username: str | None
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

fs_token_uniquifier: str
webauthn: list[WebAuthnMixin]