Repository navigation
feat(cms): staff sign in to the Payload admin with Lumen (LX1) - #19
Merged
Merged
Conversation
Staff accounts (admin, editor, instructor) no longer have Payload passwords. /admin shows a Lumen sign-in (emailed code, GitHub, Google); the session goes into an HttpOnly cookie on the CMS host, and a `lumen` auth strategy on `users` resolves it through api-edge over the LUMEN_API service binding and maps the Lumen user to a `users` row. Learners are a separate collection and keep their own accounts and the academy's /login and /register. Ported from sourceplane/lumen-payload#22 (PX1) with the LMS's differences (multi-tenant-saas-2-console design §2-§6). - users: local strategy off (its columns stay), `lumenUserId` (unique, set by no request), `role` optional with no default: no role means pending; the instructor role and its academies stay, and admin access still admits all three staff roles - the first admin still needs the owner's setup token; admins grant the rest, and inviting by email links the row on that person's first sign-in - the pending page replaces Payload's unauthorized view; sign-out revokes the Lumen session - a request naming another origin gets no staff user, so no other page (a sibling Worker on the same workers.dev site included) can write with the cookie - migration 320_cms_lumen_identity, converted from Payload's; the converter accepts column default and nullability changes as idempotent - the Lumen routes live in a (site) group with its own minimal layout; the academy keeps / - api-edge CORS and identity-worker's OAuth return allowlist gain the CMS origin of each environment - docs: runbook, architecture, overview, operations guide; epic status Orun-Task: LX-2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013JuHbkZCjDrGgHdzCrCRqG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LX1 of
multi-tenant-saas-2-console(task LX-2, milestone LX1). It ports sourceplane/lumen-payload#22 (PX1), adapted to the LMS as the spec (#18) lays out.Staff (admin, editor, instructor) sign in to
/adminwith their Lumen account, and staff no longer have Payload passwords. Learners are untouched: they keep their own accounts and the academy's/loginand/register.What changes
users:lumenstrategy is on. It resolves thelumen_sessioncookie with api-edge over a newLUMEN_APIservice binding.lumenUserIdis unique and set by no request.roleis optional with no default; no role means pending.isForeignOrigin).320_cms_lumen_identity, generated against this repo's snapshot. Its SQL is byte-identical to lumen-payload's206. The converter change came with it.(site)group with a minimal layout; the academy keeps/.(site)layout, and that when a browser holds both a staff and a learner session, the staff session wins.Verification (local, the built Worker in workerd against stage's real api-edge)
/, register, My learning, and a learner can't get into the admin.tests/cms141,tests/api-edge408,tests/identity-worker180,tests/db609.apps/cmsandtests/cms; lint shows 0 errors.After merge: on stage and prod,
/adminshows the Lumen sign-in and password login answers 403. Stage and prod have no staff accounts yet, so nobody loses access. Opening the first admin needs the owner'sCMS_SETUP_TOKEN.Orun-Task: LX-2
Generated by Claude Code