Site settings → Access names a group for each of admin, editor and viewer (migration 047). Someone in one who signs in with Google gets a Google-only account with their highest group's role, and the role follows the groups: at every sign-in, hourly while signed in, and on Panel → Google groups → Re-sync now. Out of every group, the account is disabled and signed out until they're back in one. Group accounts' roles are locked in the Panel; a superadmin's Disable sticks. Superadmins and admin-cli accounts are never changed. If Google can't be asked, sign-ins are refused but the hourly check leaves accounts alone. Panel → Check their groups tests an email. Lookups use the service account through the Directory API as GOOGLE_DIRECTORY_AS. Setup: docs/google-sign-in.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.8 KiB
SQL
29 lines
1.8 KiB
SQL
-- ═══════════════════════════════════════════════════════════════
|
|
-- 047 ACCESS BY GOOGLE GROUP
|
|
--
|
|
-- Admin access from Google Workspace groups (accessGroups.js).
|
|
-- Panel → Site settings → Access names a group for each of viewer,
|
|
-- editor and admin. Someone in one of them who signs in with Google
|
|
-- gets an account with the highest of those roles, and keeps it only
|
|
-- while they're in the group. Superadmins and admin-cli accounts are
|
|
-- never touched.
|
|
--
|
|
-- admin_users.access_source 'manual' (admin-cli, the Panel) or
|
|
-- 'group' (made by a group sign-in;
|
|
-- Google only, role follows the group)
|
|
-- admin_users.group_disabled 1 when a group check turned it off
|
|
-- (back in a group turns it on again);
|
|
-- a superadmin's Disable sets 0, and
|
|
-- that one sticks
|
|
-- admin_users.groups_checked_at the last group check, UTC
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
|
|
ALTER TABLE admin_users ADD COLUMN access_source TEXT NOT NULL DEFAULT 'manual'
|
|
CHECK (access_source IN ('manual', 'group'));
|
|
ALTER TABLE admin_users ADD COLUMN group_disabled INTEGER NOT NULL DEFAULT 0
|
|
CHECK (group_disabled IN (0, 1));
|
|
ALTER TABLE admin_users ADD COLUMN groups_checked_at TEXT;
|
|
|
|
ALTER TABLE site_settings ADD COLUMN access_group_viewer TEXT;
|
|
ALTER TABLE site_settings ADD COLUMN access_group_editor TEXT;
|
|
ALTER TABLE site_settings ADD COLUMN access_group_admin TEXT;
|