mobile-api /api/admin/**: login, me, logout, first-login, forgot password; users (list, create, edit, deactivate, emailed reset); roles (list, create, rename, module grants). Enforced in AppAccessAspect: admin token only, logged-out and deactivated tokens refused, pending first login confined, @AdminModule checked against the caller's roles, super admin passes.
Self-escalation closed (from the branch review): a non-super admin cannot change their own roles or the grants of a role they hold; ROLE_ADMIN / ROLE_MEMBER cannot be assigned; no direct set-password endpoint, only the emailed reset.
services-auth: findUserByToken returns nothing for a logged-out token.
services-system: user.company_id, company table, Area.BO, roles saved without cascade, resetAdminPassword refuses disabled users.
api-gateway: /user/resetAdminPassword reachable without a user token (forgot password).
Admin portal: cut down to login, first login, forgot password, users, roles, role access, not-authorised.
SQL in the change folder (company, BO modules, rollback), mirrored in local/seed/; smoke check logs in through mobile-api.
Local stack: local/smoke.sh OK; browser check with screenshots in openspec/changes/add-admin-auth-users-roles/verification/; own-role, hidden-role and removed-endpoint rules checked live.
Known follow-ups
Forgot password has no rate limit and its timing differs on a match (accepted for phase 1).
User list loads in memory and is not company-scoped.
A refreshed-away token stays valid until it expires.
OpenSpec change `add-admin-auth-users-roles`.
## What
- **mobile-api `/api/admin/**`**: login, me, logout, first-login, forgot password; users (list, create, edit, deactivate, emailed reset); roles (list, create, rename, module grants). Enforced in `AppAccessAspect`: admin token only, logged-out and deactivated tokens refused, pending first login confined, `@AdminModule` checked against the caller's roles, super admin passes.
- **Self-escalation closed** (from the branch review): a non-super admin cannot change their own roles or the grants of a role they hold; `ROLE_ADMIN` / `ROLE_MEMBER` cannot be assigned; no direct set-password endpoint, only the emailed reset.
- **services-auth**: `findUserByToken` returns nothing for a logged-out token.
- **services-system**: `user.company_id`, `company` table, `Area.BO`, roles saved without cascade, `resetAdminPassword` refuses disabled users.
- **api-gateway**: `/user/resetAdminPassword` reachable without a user token (forgot password).
- **Admin portal**: cut down to login, first login, forgot password, users, roles, role access, not-authorised.
- **SQL** in the change folder (company, BO modules, rollback), mirrored in `local/seed/`; smoke check logs in through mobile-api.
## Verification
- `mvn -T 1C -B -q verify`: exit 0.
- Portal: vitest 850/850, `tsc --noEmit` clean, lint 0 errors.
- `openspec validate add-admin-auth-users-roles --strict`: valid.
- Local stack: `local/smoke.sh` OK; browser check with screenshots in `openspec/changes/add-admin-auth-users-roles/verification/`; own-role, hidden-role and removed-endpoint rules checked live.
## Known follow-ups
- Forgot password has no rate limit and its timing differs on a match (accepted for phase 1).
- User list loads in memory and is not company-scoped.
- A refreshed-away token stays valid until it expires.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Ported from babyboo: @AdminModule, AdminModuleAccess, AdminSessionGuard and the
admin branch of AppAccessAspect. Adds the BO area, and services-auth findUserByToken
now returns no user for a logged-out token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Wrong, blank or failed logins all answer the same 401. A deactivated admin is
refused and the token services-auth issued is revoked. resetAdminPassword now
refuses deactivated users and users without an email.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
New users get a temporary password by email and the creating admin's company.
Self-deactivation and super-admin changes by non-super admins are refused.
services-system: saving a user no longer cascades into role rows.
Local seed: dev admin on the GLOBAL branch (id 0 does not exist).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
Removes every other screen, API route, component, test and the dependencies only
they used. Cookie colite_admin, Co-Lite branding, BO_USERS/BO_ROLES modules only.
The user form no longer loads branches, events or country scope.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
/forgot-password always shows the same message; the route never forwards upstream
errors or a token. /api/admin/me now returns id and username so the user form can
lock the Active switch on your own account.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
- Login copy describes the event CRM instead of orders and payouts.
- Role dialog has no parent field; the role routes require a trimmed name and forward only {name}.
- New-user banner says a temporary password was emailed; TEMP_PASSWORD_NOT_SENT shows a message and a link back to users.
- Username is read-only when editing.
- Password hint and an 8-character minimum match the backend admin password rules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
- A non-super admin cannot change the roles on their own account (403 OWN_ROLES).
- ROLE_ADMIN and ROLE_MEMBER cannot be assigned (400 UNKNOWN_ROLE, as if absent).
- A non-super admin cannot change the grants of a role they hold (403 OWN_ROLE);
this replaces the BO_ROLES lock-out check, which it makes unreachable.
- POST /api/admin/users/{id}/changePassword is removed; the emailed reset stays.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
services-system writes a role already seen in a response as its bare id. The
module check missed it, so a role granted two modules was refused the second;
the super-admin target guard now reads it too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
ngqile
merged commit 5d63b2bbec into main2026-11-26 14:40:32 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
OpenSpec change
add-admin-auth-users-roles.What
/api/admin/**: login, me, logout, first-login, forgot password; users (list, create, edit, deactivate, emailed reset); roles (list, create, rename, module grants). Enforced inAppAccessAspect: admin token only, logged-out and deactivated tokens refused, pending first login confined,@AdminModulechecked against the caller's roles, super admin passes.ROLE_ADMIN/ROLE_MEMBERcannot be assigned; no direct set-password endpoint, only the emailed reset.findUserByTokenreturns nothing for a logged-out token.user.company_id,companytable,Area.BO, roles saved without cascade,resetAdminPasswordrefuses disabled users./user/resetAdminPasswordreachable without a user token (forgot password).local/seed/; smoke check logs in through mobile-api.Verification
mvn -T 1C -B -q verify: exit 0.tsc --noEmitclean, lint 0 errors.openspec validate add-admin-auth-users-roles --strict: valid.local/smoke.shOK; browser check with screenshots inopenspec/changes/add-admin-auth-users-roles/verification/; own-role, hidden-role and removed-endpoint rules checked live.Known follow-ups
🤖 Generated with Claude Code
https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
- Login copy describes the event CRM instead of orders and payouts. - Role dialog has no parent field; the role routes require a trimmed name and forward only {name}. - New-user banner says a temporary password was emailed; TEMP_PASSWORD_NOT_SENT shows a message and a link back to users. - Username is read-only when editing. - Password hint and an 8-character minimum match the backend admin password rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM- A non-super admin cannot change the roles on their own account (403 OWN_ROLES). - ROLE_ADMIN and ROLE_MEMBER cannot be assigned (400 UNKNOWN_ROLE, as if absent). - A non-super admin cannot change the grants of a role they hold (403 OWN_ROLE); this replaces the BO_ROLES lock-out check, which it makes unreachable. - POST /api/admin/users/{id}/changePassword is removed; the emailed reset stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM