From d8579c0a592732d33730fc34f62608802018fcef Mon Sep 17 00:00:00 2001 From: AdrianoDev Date: Sat, 25 Jul 2026 16:43:46 +0200 Subject: [PATCH] Accesso al Biohacking dal menu del sito e dal login pubblico Co-Authored-By: Claude Fable 5 --- src/components/Header.astro | 9 ++++++++- src/middleware.ts | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/Header.astro b/src/components/Header.astro index 1729495..a959153 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,6 +1,7 @@ --- import { site } from '../data/site'; import { t, contentImageUrl } from '../lib/content'; +import { landingFor } from '../lib/auth'; interface Props { user: { username: string; role: string } | null; showTags: boolean; @@ -9,7 +10,9 @@ interface Props { const { user, canTags, showTags } = Astro.props; const path = Astro.url.pathname; const loginHref = `/login?next=${encodeURIComponent(path)}`; -const areaHref = user?.role === 'superuser' ? '/admin/content' : '/admin'; +const areaHref = user ? landingFor(user.role) : '/admin'; +// La sezione Biohacking compare nel menu solo a chi può davvero aprirla. +const canBiohacking = user?.role === 'campus' || user?.role === 'admin'; ---