feat(backend): link cards to users; charger-qualified gun restrictions; config-driven gun labels

- Allowlist entries take "user": <username> — sessions started with that
  card attribute to the person, and the owner sees their card's history
  even without gun-wide permissions (ownership looked up live)
- "guns": ["eu092025:2"] (fnmatch) replaces the charger-blind
  "connectors": [2] restriction — safe with multiple chargers
- New "chargers" config section provides per-charger/per-gun display
  names; the panel no longer hardcodes the Anfu gun labels
- Panel admin tab: owner dropdown + guns field on card entries
- Smoke test: 42 checks, incl. retroactive history visibility after
  linking a card and rejection of links to unknown users
This commit is contained in:
2026-07-11 20:03:36 +02:00
parent 3326c8d16c
commit 70c2fe1210
8 changed files with 85 additions and 39 deletions
+15 -4
View File
@@ -19,14 +19,25 @@
}
},
"authorized": {
"1000000000000000": { "name": "Example RFID card, works on both guns", "kind": "card" },
"1000000000000001": {
"name": "Example RFID card restricted to gun 2",
"1000000000000000": {
"name": "Card linked to a user, works everywhere",
"kind": "card",
"connectors": [2]
"user": "admin-user"
},
"1000000000000001": {
"name": "Card restricted to gun 2 of one charger",
"kind": "card",
"user": "gun1-only-user",
"guns": ["eu092025:2"]
},
"app-remote": { "name": "Web/app remote start token", "kind": "app" }
},
"chargers": {
"eu092025": {
"label": "Anfu 60kW",
"guns": { "1": "Gun 1 · EU (CCS)", "2": "Gun 2 · GB/T" }
}
},
"relays": {
"example-relay": {
"id": "<tuya device id from tinytuya wizard>",