+ Connect the Microsoft account whose default calendar you want to use. + This account is separate from your Booking login. +
+Loading calendar connection…
} + {status.data && ( + <> ++ {status.data.connected + ? 'Microsoft authentication cached' + : 'Not connected'} +
+ {status.data.connected && status.data.calendarEmail && ( +Connected calendar: {status.data.calendarEmail}
+ )} + {status.data.username && ( +Cached Microsoft account: {status.data.username}
+ )} +{status.data.message}
+ > + )} + {outcome === 'connected' && ( ++ Calendar authentication completed. Run the read-only check to verify + access. +
+ )} + {outcome === 'failed' && ( ++ {status.data?.lastError ?? + 'Calendar authentication failed or expired. Start the connection again.'} +
+ )} + {error &&{calendarErrorMessage(error)}
} + {check.data && ( +Microsoft account used for check: {check.data.username}
+ )} +{check.data.message}
++ Enter a valid recipient email address. +
+ )} ++ + Creating the event on the development calendar. Please wait… +
+ )} + {meeting.error && ( ++ {calendarErrorMessage(meeting.error)} +
+ )} ++ Microsoft Graph successfully created the event. +
+{meeting.data.message}
+Create and update buildings and other named locations. @@ -94,19 +98,31 @@ function SiteAdminPage() { className="group flex flex-col rounded-sm border border-base-300 bg-base-200 p-6 shadow-sm transition hover:border-primary/40 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-primary sm:p-8" to="/admin/resource-templates" > - -
Build and preview reusable request forms, manage templates, and duplicate existing forms.
+ ++ Build and preview reusable request forms, manage templates, and + duplicate existing forms. +
Manage resource templates - + +- Site administrators have access across Booking. Team administrators manage - their own teams and resources; team permissions do not grant access - here. + Site administrators have access across Booking. Team administrators + manage their own teams and resources; team permissions do not grant + access here.
); diff --git a/client/src/test/mswUtils.ts b/client/src/test/mswUtils.ts index 383b880..4587d12 100644 --- a/client/src/test/mswUtils.ts +++ b/client/src/test/mswUtils.ts @@ -4,6 +4,16 @@ import { afterAll, afterEach, beforeAll } from 'vitest'; // Create a shared MSW server instance that can be used across all tests export const testServer = setupServer( + http.get('/api/development-graph/status', () => + HttpResponse.json({ + calendarEmail: null, + configured: false, + connected: false, + message: 'Development calendar is not configured.', + testMeetingEnabled: false, + username: null, + }) + ), http.get('/api/admin/spaces', () => HttpResponse.json([])), http.get('/api/teams/:teamSlug/spaces', () => HttpResponse.json([])), http.get('/api/teams', () => HttpResponse.json([])), diff --git a/docs/GRAPH-DEVELOPMENT.md b/docs/GRAPH-DEVELOPMENT.md new file mode 100644 index 0000000..8e52fd2 --- /dev/null +++ b/docs/GRAPH-DEVELOPMENT.md @@ -0,0 +1,217 @@ +# Connect the Graph calendar + +Booking login and calendar authorization are separate. Booking's cookie/OIDC login +establishes the application session. A site administrator then connects the +Microsoft account whose default calendar should be connected. The connection does +not replace the administrator's Booking session or use `/signin-oidc`. + +Local development uses a local file token cache. Hosted test and +production environments use their own Key Vault secret for the token cache. No +Blob storage, database tables, or migrations are required. + +## Registration prerequisites + +IT must confirm the Graph confidential-client registration, a sign-in-capable +calendar account, delegated `Calendars.ReadWrite` consent, and the account's MFA / +Conditional Access requirements. Application permissions are not used. + +Register the callback as **Web**, not SPA or Mobile/Desktop: + +- Local UI: `http://localhost:5173/api/development-graph/callback`. +- Hosted: `https://