feat: private session history, own-permissions view, plug-gated start button

- non-admins now see ONLY their own sessions in /api/sessions (own app
  starts + own linked cards); gun scopes grant control, not visibility;
  admins see everything
- Account page shows the logged-in user's permissions in plain words
  (Administrator badge, or the guns/relays they control), built solely
  from data already visible to them
- Start button arms only when the gun reports Preparing (cable in the
  car); idle unplugged gun shows an explanatory hint instead
- keep owner's app rename to 'Art IoT'
- smoke test: 59 checks (gun-scoped user sees no foreign sessions)
This commit is contained in:
2026-07-12 09:04:06 +02:00
parent 3387f8689e
commit 069d544bb5
12 changed files with 98 additions and 17 deletions
+6 -1
View File
@@ -93,7 +93,9 @@ function gunState(gun: Gun): { label: string; cls: string } {
function GunBay({ gun, scopes }: { gun: Gun; scopes: string[] }) {
const toast = useApp((s) => s.toast);
const may = scopeAllowed(scopes, `charger:${gun.cp}:${gun.connector}`);
const ready = !gun.tx && (gun.ocppStatus === "Preparing" || gun.ocppStatus === "Available");
// Start arms ONLY with a cable in the car (Preparing / pulsing blue) —
// an idle, unplugged gun keeps the button disabled (owner, 2026-07-12)
const ready = !gun.tx && gun.ocppStatus === "Preparing";
const start = useAction(
() =>
@@ -160,6 +162,9 @@ function GunBay({ gun, scopes }: { gun: Gun; scopes: string[] }) {
</button>
)}
{!may && <span className="bay__hint">no permission for this gun</span>}
{may && !gun.tx && !ready && gun.ocppStatus === "Available" && (
<span className="bay__hint">plug the cable into the car to enable</span>
)}
</footer>
</article>
);