Admin user management page (/admin/users) #10
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/westside-landing#10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-2026-03-08-tryout-prep→ Phase 5e → Phase 5e-2 (Admin user management page)Repo
forgejo_admin/westside-appUser Story
As an admin (Marcus)
I want to manage Keycloak user accounts from the dashboard
So that I can reset passwords, change roles, and view all users without touching the Keycloak console
Context
Phase 5e-1 bulk-created 48 Keycloak accounts for paid families. Marcus needs a way to manage these accounts — reset passwords when parents forget them, change roles (player/coach/admin), and see who's registered. The Keycloak admin console is too complex for a non-technical user. This page gives Marcus a simple, purpose-built interface.
The app uses Auth.js with Keycloak OIDC. The JWT callback extracts
realm_access.rolesand attaches them to the session. The realm iswestside-basketballwith three custom roles:admin,coach,player.Password pattern is
Westside-{FirstName}-{2digits}(e.g.,Westside-Marcus-47).File Targets
Files to create:
src/lib/server/keycloak-admin.js— Keycloak Admin REST API client (token acquisition, list users, reset password, role management)src/routes/admin/users/+page.server.js— load function (list users with roles) + form actions (resetPassword, changeRole)src/routes/admin/users/+page.svelte— user list UI with search, role badges, action buttonsFiles to modify:
src/routes/admin/+page.svelte— add "Manage Users" navigation linkk8s/deployment.yaml— addKEYCLOAK_ADMIN_URLandKEYCLOAK_ADMIN_PASSWORDenv varsk8s/auth-secret.enc.yaml— addkeycloak-admin-passwordkey (SOPS encrypted)Files NOT to touch:
src/auth.js— auth config is complete, no changes neededsrc/hooks.server.js— no changes neededsrc/routes/coach/— unrelatedAcceptance Criteria
/admin/usersas an admin, I see a list of all Keycloak users with their name, email, and role/admin/userswithout a session, I'm redirected to/signin/admin/userswith a non-admin role, I get 403 ForbiddenWestside-{Name}-{NN}password is generated, set in Keycloak, and displayed once in a prominent banner with a copy button/adminpage has a "Manage Users" link to/admin/usersdeployment.yamlhasKEYCLOAK_ADMIN_URLandKEYCLOAK_ADMIN_PASSWORDenv varsTest Expectations
/admin/users, verify user list loads/admin/usersas non-admin, verify 403Constraints
src/routes/admin/+page.server.jslines 24-34, form actions withuse:enhance, Svelte 5$state()/$derived()(NOT stores)https://keycloak.tail5b443a.ts.net. Read fromKEYCLOAK_ADMIN_URLenv var via$env/dynamic/privateadmin, password fromKEYCLOAK_ADMIN_PASSWORDenv varwestside-basketballPOST /realms/master/protocol/openid-connect/token(client_id=admin-cli, grant_type=password)GET /admin/realms/westside-basketball/users?search={query}&max=100PUT /admin/realms/westside-basketball/users/{id}/reset-passwordbody:{"type":"password","value":"...","temporary":false}GET /admin/realms/westside-basketball/rolesGET /admin/realms/westside-basketball/users/{id}/role-mappings/realmPOST /admin/realms/westside-basketball/users/{id}/role-mappings/realmbody:[roleRepresentation]DELETE /admin/realms/westside-basketball/users/{id}/role-mappings/realmbody:[roleRepresentation]Westside-${firstName}-${Math.floor(Math.random()*90)+10}fetch— available in SvelteKit server context, no external HTTP libraryage15ct78fr4scv4vxzj3k6q76wshywzlu0mdc64a624e264dst7zfaq6tjzjr. The.sops.yamlconfig should exist in repo root. Runsops k8s/auth-secret.enc.yamlto edit.awk -F= '/^KEYCLOAK_ADMIN_PASSWORD=/{print $2}' ~/secrets/pal-e-services/secrets.envChecklist
Closes #10Related
westside-basketball— projectplan-2026-03-08-tryout-prep— parent plan