M1 (9): dashboard alerts by role

IntegrationAlerts reads the admin-only Site integrations global with access
control off and showed its error texts to everyone who opened the dashboard.
Now: an admin sees what is failing and the link, an editor a neutral "an
integration needs attention — ask an administrator", anyone else nothing.
CookieCrawlAlert is shown to editors and above (the role that may read the crawl
result). Both use userMeetsRole, so a session that still owes its second factor
sees neither. dashboardAlerts: { integrations: 'admin' | 'editor' | 'all',
cookies: 'editor' | 'all' } loosens it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 00:39:12 +01:00
co-authored by Claude Fable 5.2
parent 5d35b2c3f4
commit 0b4c4e8295
7 changed files with 173 additions and 13 deletions
+16 -5
View File
@@ -101,6 +101,22 @@ export type IpalOptions = {
*/
cookieScanner?: boolean | CookieScannerOptions
/**
* Forms — form-builder collections (forms, form-submissions) plus the
* callable submitForm (Turnstile + persistence + SMTP-from-panel email).
*/
/**
* Who sees the plugin's dashboard alerts. They read data that only some
* roles may read, so each decides for itself:
* `integrations` — who gets WHAT is failing in Site integrations (error text
* and link): `'admin'` (default), `'editor'`, `'all'`; an editor below that
* sees a neutral "an integration needs attention — ask an administrator",
* anyone else nothing. `cookies` — who sees the cookie crawl / approval
* alert: `'editor'` (default) or `'all'`. `'all'` = as before. A session
* that still owes its second factor sees none of them.
*/
dashboardAlerts?: { cookies?: 'all' | 'editor'; integrations?: 'admin' | 'all' | 'editor' }
/**
* GET /api/ipal/doctor — read-only counts for `ipal-doctor --url` (users without 2FA, cookies
* waiting for approval, versions). Answers 404 until IPAL_DOCTOR_TOKEN (≥ 32 characters) is set;
@@ -125,11 +141,6 @@ export type IpalOptions = {
* Building blocks: buildFillEmptyLocalesGlobalHook / …CollectionHook.
*/
fillEmptyLocales?: { 'cookie-review'?: string[]; 'cookie-settings'?: string[] } | boolean
/**
* Forms — form-builder collections (forms, form-submissions) plus the
* callable submitForm (Turnstile + persistence + SMTP-from-panel email).
*/
forms?: FormsOption
/**