Allow logged in user to change some of its data. Administrators can lock users using the is_active field.

This commit is contained in:
grossmj committed 2021-08-09 16:36:18 +09:30
1 parent 1f0ceb6f74
commit 6dd0f4d4d3
4 files changed
+101 -6

No files matched your search

+11 -1
View File
@@ -28,6 +28,7 @@ class UserBase(BaseModel):
"""
username: Optional[str] = Field(None, min_length=3, regex="[a-zA-Z0-9_-]+$")
is_active: bool = True
email: Optional[EmailStr]
full_name: Optional[str]
@@ -49,11 +50,20 @@ class UserUpdate(UserBase):
password: Optional[SecretStr] = Field(None, min_length=6, max_length=100)
class LoggedInUserUpdate(BaseModel):
"""
Properties to update a logged in user.
"""
password: Optional[SecretStr] = Field(None, min_length=6, max_length=100)
email: Optional[EmailStr]
full_name: Optional[str]
class User(DateTimeModelMixin, UserBase):
user_id: UUID
last_login: Optional[datetime] = None
is_active: bool = True
is_superadmin: bool = False
class Config: