Skip to main content

UserBase

This class serves as the foundational data model for user entities, defining core attributes such as email, active status, and administrative privileges. It utilizes SQLModel to provide integrated validation and database mapping for user-related information.

Attributes​

AttributeTypeDescription
emailEmailStrUnique email address used as the primary identifier for account authentication and communication, limited to 255 characters.
is_activebool = TrueBoolean flag indicating whether the user account is currently enabled and permitted to access the system.
is_superuserbool = FalseBoolean flag that grants the user administrative privileges and unrestricted access to all system resources.
full_name`strNone` = None

Constructor​

Signature​

def UserBase(
email: EmailStr,
is_active: bool = True,
is_superuser: bool = False,
full_name: str | None = None
) - > null

Parameters​

NameTypeDescription
emailEmailStrThe unique email address for the user, used as an index.
is_activebool = TrueBoolean flag indicating if the user account is currently active.
is_superuserbool = FalseBoolean flag indicating if the user has administrative privileges.
full_name`strNone` = None

Methods​


email()​

def email() - > EmailStr

The unique email address used as the primary identifier for the user account.

Returns​

TypeDescription
EmailStrA validated email address string.

is_active()​

def is_active() - > bool

Indicates whether the user account is currently enabled and permitted to access the system.

Returns​

TypeDescription
boolTrue if the account is active, False otherwise.

is_superuser()​

def is_superuser() - > bool

Determines if the user has administrative privileges across the entire application.

Returns​

TypeDescription
boolTrue if the user has superuser status, False for standard users.

full_name()​

def full_name() - > str | null

The optional legal or display name associated with the user profile.

Returns​

TypeDescription
`strnull`