refactor(backend): remove the v1 auth and permission leftovers no frontend uses
Platform-v2 step 2.99a. After 2.6 no frontend calls these any more:
- POST /api/auth/login needs `client` (manager/waiter/terminal); the no-`client`
path with v1 rules and the `legacy_manager` single-session exception are gone.
- GET /api/setup/security-config (bootstrap's `login` replaced it in 2.6b).
- POST /api/recovery/use (a recovery code works in the normal login's
password field).
- PUT /api/waiters/{id}/permission and /reset-permissions (the permission editor
saves keys with PUT /{id}/permissions); staff create/update ignore perm_* fields.
- The v1 perm_* projection: core/access/legacy.py deleted, UserOut carries only
`permissions` (no app reads the 13 booleans, waiter included).
e2e manager login sends client "manager"; smoke_routes too. Backend 281 passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,7 +62,7 @@ def single_session_rule(db, client: str) -> str:
|
||||
|
||||
# ── lifecycle ────────────────────────────────────────────────────────────────
|
||||
|
||||
def start(db, user, client: str, request=None, *, legacy_manager: bool = False, device=None, expires_at=None):
|
||||
def start(db, user, client: str, request=None, *, device=None, expires_at=None):
|
||||
"""Create a session for user (None user_id for the support account). Commits.
|
||||
`device`: the paired device of a terminal login; its previous sessions are replaced
|
||||
(a shared screen shows one user at a time)."""
|
||||
@@ -71,10 +71,6 @@ def start(db, user, client: str, request=None, *, legacy_manager: bool = False,
|
||||
raise ValueError(f"unknown client {client!r}")
|
||||
user_id = getattr(user, "id", None) or None
|
||||
rule = single_session_rule(db, client)
|
||||
if legacy_manager and rule == "refuse_new":
|
||||
# The current manager UI re-logs-in to unlock its lock screen; refusing would lock
|
||||
# the owner out. Until the phase 2 manager has a real unlock, treat it as end_old.
|
||||
rule = "end_old"
|
||||
if user_id is not None and rule != "off":
|
||||
active = db.query(LoginSession).filter(LoginSession.user_id == user_id, LoginSession.client == client,
|
||||
LoginSession.ended_at.is_(None)).all()
|
||||
|
||||
Reference in New Issue
Block a user