feat(cloud-console): add user authentication and administration
This commit is contained in:
@@ -97,5 +97,51 @@ class PluginResponse(BaseModel):
|
||||
wired: bool
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
username: str = Field(min_length=1, max_length=64)
|
||||
password: str = Field(min_length=1, max_length=256)
|
||||
|
||||
|
||||
class PasswordChangeRequest(BaseModel):
|
||||
current_password: str = Field(min_length=1, max_length=256)
|
||||
new_password: str = Field(min_length=1, max_length=256)
|
||||
|
||||
|
||||
class UserResponse(BaseModel):
|
||||
id: str
|
||||
username: str
|
||||
display_name: str
|
||||
role: Literal["viewer", "operator", "admin"]
|
||||
enabled: bool
|
||||
must_change_password: bool
|
||||
scopes: list[str]
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
last_login_at: datetime | None = None
|
||||
|
||||
|
||||
class UserListResponse(BaseModel):
|
||||
items: list[UserResponse]
|
||||
limit: int
|
||||
offset: int
|
||||
|
||||
|
||||
class UserCreateRequest(BaseModel):
|
||||
username: str = Field(min_length=1, max_length=64)
|
||||
display_name: str = Field(min_length=1, max_length=120)
|
||||
role: Literal["viewer", "operator", "admin"]
|
||||
password: str = Field(min_length=1, max_length=256)
|
||||
|
||||
|
||||
class UserUpdateRequest(BaseModel):
|
||||
display_name: str | None = Field(default=None, min_length=1, max_length=120)
|
||||
role: Literal["viewer", "operator", "admin"] | None = None
|
||||
enabled: bool | None = None
|
||||
|
||||
|
||||
class PasswordResetRequest(BaseModel):
|
||||
password: str = Field(min_length=1, max_length=256)
|
||||
|
||||
|
||||
class ErrorResponse(BaseModel):
|
||||
detail: str
|
||||
|
||||
Reference in New Issue
Block a user