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
| Attribute | Type | Description |
|---|---|---|
EmailStr | Unique email address used as the primary identifier for account authentication and communication, limited to 255 characters. | |
| is_active | bool = True | Boolean flag indicating whether the user account is currently enabled and permitted to access the system. |
| is_superuser | bool = False | Boolean flag that grants the user administrative privileges and unrestricted access to all system resources. |
| full_name | `str | None` = None |
Constructor
Signature
def UserBase(
email: EmailStr,
is_active: bool = True,
is_superuser: bool = False,
full_name: str | None = None
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
EmailStr | The unique email address for the user, used as an index. | |
| is_active | bool = True | Boolean flag indicating if the user account is currently active. |
| is_superuser | bool = False | Boolean flag indicating if the user has administrative privileges. |
| full_name | `str | None` = None |
Methods
email()
def email() - > EmailStr
The unique email address used as the primary identifier for the user account.
Returns
| Type | Description |
|---|---|
EmailStr | A 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
| Type | Description |
|---|---|
bool | True 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
| Type | Description |
|---|---|
bool | True 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
| Type | Description |
|---|---|
| `str | null` |