feat(manager): staff permission editor, signed-in sessions, approvals log (platform-v2 2.6e)

- Staff: the 13 perm_* tick columns become one Permissions column (count,
  "changed from role") opening an editor grouped by module, from
  /api/waiters/permission-catalog: switches labelled per key, keys you don't
  hold are disabled with the reason, reset to role defaults (names what it
  can't give), save the whole set; access.cannot_grant explained by label.
- "Signed in now" (/management/sessions): who, where (app or device), since,
  last active, your own session marked; end session; show ended + reason.
- "Manager approvals" (/management/approvals): the override audit with
  action label, asked by, approved by, device, used/not used, order link.
- Backend: sessions list adds device_name/device_app/current/expires_at;
  overrides list adds device_name/expires_at.
- Permission labels for every key in modules.json (en/el), guarded by
  test_module_texts; manager unit tests for the editor logic; e2e 66 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 08:10:57 +02:00
co-authored by Claude Opus 5.5
parent cc00ec39c7
commit 92bc1b0113
20 changed files with 1135 additions and 189 deletions
+11
View File
@@ -296,3 +296,14 @@ def test_waiter_tap_still_needs_device(client, make_user, login):
client.put("/api/settings/auth.waiter_login_mode", headers=admin_h, json={"value": "tap"})
w = make_user(role="waiter")
assert err(client.post("/api/auth/login", json={"client": "waiter", "user_id": w.id})) == "auth.mode_needs_device"
def test_sessions_list_names_the_device_and_the_callers_own(client, owner_h, pair, make_user): # 2.6e
token, _ = pair("kds", "Kitchen")
chef = make_user(role="chef")
client.post("/api/auth/login", headers=dev_h(token), json={"client": "terminal", "user_id": chef.id, "pin": TEST_PIN})
rows = client.get("/api/auth/sessions", headers=owner_h).json()
term = next(s for s in rows if s["user_id"] == chef.id)
assert term["client"] == "terminal" and term["device_name"] == "Kitchen" and term["device_app"] == "kds"
assert term["current"] is False
assert [s["current"] for s in rows].count(True) == 1 # the owner's own session