Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
3.6 KiB
3.6 KiB
Proposal
Why
Lead capture (change 4) needs staff to log in to the admin portal and needs Sales users to exist. Today the copied admin portal is babyboo's full back office, and mobile-api has no /api/admin/** endpoints, so nobody can log in. This change gives Co-Lite a working staff login, user management and role permissions: the base every later admin screen builds on. See docs/superpowers/specs/2026-11-26-co-lite-foundation-and-leads-design.md (Admin portal, Access, Company id).
What Changes
- Admin portal cut down to: login, first-login password change, forgot password, Users (list, create, edit, deactivate, assign roles, reset password), Roles (list, create, edit, edit permissions), the app shell with role-based menus, and the not-authorised page. Every other babyboo screen, API route, component and test is removed, along with dependencies only they used.
- New forgot-password page in the portal. It uses Tastefully's existing reset: username plus email, a temporary password is emailed, and the user must change it at next login.
mobile-apigains/api/admin/**: auth (login, first-login, forgot password, logout, refresh),me, users, roles and role permissions. Ported from babyboo's AdminAuth, AdminUser and AdminRole controllers onto Co-Lite's existingservices-authandservices-systemendpoints.- Admin access enforcement in
mobile-api: on/api/admin/**, a non-admin token is rejected, a logged-out token is rejected, a pending first-login reset confines the token to the first-login endpoint, and each handler declares the modules it needs (@AdminModule), checked against the caller's roles. Super admin passes every module check. - Wrong-password login returns 401 at
/api/admin/auth/login(todayservices-authanswers 200 with an empty body). - Company: a
companytable and acompany_idcolumn on the adminuserinservice-system. New users get the creating admin's company. - Back-office modules: Co-Lite's own BO module rows (root, Users, Roles) in
service-system.module. SQL lives in this change folder and is mirrored inlocal/seed/.
Not in this change: login lockout, session-policy and login-security screens, the module-management screen, user groups, audit log, Google sign-in (all babyboo features Co-Lite drops in phase 1).
Capabilities
New Capabilities
admin-access: staff login, first-login password change, forgot password, logout, session, menus, and the rules that guard every/api/admin/**endpoint and admin portal page.admin-users: managing staff users (list, search, create, edit, deactivate, assign roles, reset password) and the company they belong to.admin-roles: managing roles and the back-office modules each role grants.
Modified Capabilities
None.
Impact
solvway-admin-portal: most of the tree is deleted; kept screens are adapted to Co-Lite (cookie name, module names, branding text).solvway-mobile-api: new admin controllers, services,@AdminModule, and admin checks inAppAccessAspect.solvway-services-system:Companyentity,User.companyId, user save sets company. No new endpoints expected (the needed ones exist); any gap found is added in the task that needs it.solvway-services-auth: unchanged unless the admin token check needs it (see design).- Database
service-system: new tablecompany, new columnuser.company_id, newmoduleandmodules_rolesrows. Additive only. local/seed/: mirrors the SQL;03-colite.sqlkeeps creating the dev admin.local/smoke.sh: the admin login call moves to/api/admin/auth/loginon mobile-api.