Files
Aegis/backend/app/schemas/auth.py
T
kitos bbe7f49c86
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
feat(tests,users): blocking procedure-suggestion review on test detail, multi-role switcher, Power Automate webhook payload
- A lead opening a test with a pending procedure suggestion awaiting
  their review now gets a blocking popup (approve/reject only) instead
  of discovering it later in a separate queue.
- Users can be granted more than one role via extra_roles; only one is
  ever active at a time (no permission mixing) and a top-bar switcher
  lets the user swap which one, taking effect immediately since role
  is read fresh from the DB on every request.
- The password-setup/reset webhook now posts the agreed Power Automate
  contract ({to, subject, body} with the platform's standard greeting
  and signature template) and supports an admin-configured API key
  sent as an x-api-key header.
2026-07-20 09:29:36 +02:00

59 lines
1.3 KiB
Python

"""Pydantic schemas for authentication endpoints."""
# Import uuid
import uuid
# Import BaseModel from pydantic
from pydantic import BaseModel
# Define class LoginRequest
class LoginRequest(BaseModel):
"""Body for the login endpoint.
Unused directly — we rely on ``OAuth2PasswordRequestForm``, but kept for
documentation and testing purposes.
"""
# username: str
username: str
# password: str
password: str
# Define class TokenResponse
class TokenResponse(BaseModel):
"""Response returned after a successful login."""
# access_token: str
access_token: str
# Assign token_type = "bearer"
token_type: str = "bearer"
# Define class UserOut
class UserOut(BaseModel):
"""Public representation of a user (no password hash)."""
# id: uuid.UUID
id: uuid.UUID
# username: str
username: str
full_name: str | None = None
# Assign email = None
email: str | None = None
# role: str
role: str
extra_roles: list[str] = []
# is_active: bool
is_active: bool
# Assign must_change_password = True
must_change_password: bool = True
# Define class Config
class Config:
"""ORM mode configuration for SQLAlchemy model mapping."""
# Assign from_attributes = True
from_attributes = True