Skip to content

fix(#173): re-activate Data Custodian admin portal + navbar contrast/link fixes#174

Merged
dfcoffin merged 2 commits into
mainfrom
fix/173-custodian-portal-restore
Jun 7, 2026
Merged

fix(#173): re-activate Data Custodian admin portal + navbar contrast/link fixes#174
dfcoffin merged 2 commits into
mainfrom
fix/173-custodian-portal-restore

Conversation

@dfcoffin

@dfcoffin dfcoffin commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Re-activates the Data Custodian admin (custodian) portal alongside the resource-server role, and fixes the navbar readability + broken navigation reported during browser testing. Closes #173.

Legacy portal templates were ported from the original OpenESPI-DataCustodian-java (JSP) to the current Thymeleaf + Bootstrap 5 stack. All pages are GET/read-first; CRUD writes remain deferred per #166 (with the exception of retail-customer create/edit/delete, which already existed and is completed here).

What was broken → fixed

  • Unreadable menu barcustodianHeader was navbar-dark (white text) on light amber bg-warning → switched to data-bs-theme="light" (dark-on-amber).
  • Every dashboard card / nav link 404'd — links were host-absolute (/custodian/...), bypassing the /DataCustodian context path → context-relative th:href="@{...}" (incl. head CSS/favicon).
  • CSS theme never loaded@EnableWebMvc disables Boot's static mappings and only /static,/images were registered → added /css,/js resource handlers + WebSecurityCustomizer ignoring static resources.
  • Logout → 401 — navbar logout was a GET <a>; Spring Security logout is POST-only → CSRF POST forms.
  • Home / → 401 — root was unmapped and fell to the stateless chain → re-enabled HomeController, added /,/home to the session chain.
  • Retail Customers / create / delete → 401 — masked 500s: Thymeleaf 3.1 forbids dynamic th:on* (delete-confirm) → static onsubmit; duplicate-username and FK-delete now handled gracefully; /error permitted so real errors show an error page, not 401; RetailCustomerService.deleteById added.
  • Customer login → 401 — post-login landing was hard-coded /custodian/home (custodian-only) → role-aware landing (custodians → dashboard, others → /).
  • "Upload Data" card smaller — equal-height cards (h-100 + flex).
  • Removed the dead "My Usage Points" nav item (customer self-service portal not yet migrated).

New/changed surface

  • New: OAuthTokenController (read-only grants table), SettingsController (read-only system info — no DB-management/reset actions), portal templates.
  • Re-enabled: HomeController, CustodianHomeController (+ stat tiles), UploadController.
  • RetailCustomerController: normalized views + edit/update/delete.

Verification (local sandbox, end-to-end via curl)

Login; /,/home,/login; all custodian pages (home/retailcustomers/oauth tokens/upload/settings) → 200; retail-customer create → edit → update → delete → 302; duplicate username handled; CSS 200; logout POST → 302; customer (ROLE_USER) login → / → 200.

Notes / follow-ups

  • Customer self-service portal (/customer/**, /RetailCustomer/**) remains disabled (out of scope).
  • Usage-point association + bulk-import remain stubbed (never migrated); pages resolve and say so.

🤖 Generated with Claude Code

dfcoffin and others added 2 commits June 7, 2026 14:13
…ast/links

The custodian dashboard rendered but every action card 404'd, the top menu
bar was unreadable, and post-login flows broke. Root causes and fixes:

UI / navigation
- Navbar contrast: custodianHeader was navbar-dark on light amber (white-on-amber,
  unreadable) -> bg-warning + data-bs-theme="light" (dark-on-amber).
- 404s: dashboard cards + nav links were host-absolute (/custodian/...), bypassing
  the /DataCustodian context path -> converted to context-relative th:href=@{...},
  including the head CSS/favicon links.
- Dashboard cards equal height (h-100 + flex) so "Upload Data" matches the others.
- Removed the dead "My Usage Points" nav item (customer portal not yet migrated).

Re-activated / added controllers (all GET/read-first; CRUD writes still deferred #166)
- HomeController ("/","/home"), CustodianHomeController ("/custodian"+"/custodian/home",
  dashboard stat tiles), UploadController re-enabled, new OAuthTokenController
  (read-only authorization-grant table) and SettingsController (read-only system info,
  no DB-management actions). Normalized RetailCustomerController view names and added
  edit/update/delete (password optional on edit; graceful duplicate/FK handling).
- RetailCustomerService.deleteById.
- Ported legacy portal templates to Thymeleaf + Bootstrap 5.

Security / serving
- WebSecurityCustomizer ignores static resources; explicit /css,/js,/images resource
  handlers (needed because @EnableWebMvc disables Boot's defaults).
- Session/form-login chain now owns the UI surface ("/","/home"); /error permitted so
  controller errors render an error page instead of a misleading 401.
- Role-aware post-login landing: custodians -> /custodian/home, others -> /.
- Logout converted to CSRF POST (Spring Security logout is POST-only).
- Thymeleaf 3.1 forbids dynamic th:on* handlers -> static onsubmit confirms.

Verified end-to-end: login, all dashboard cards/nav (200), retail-customer
create/edit/update/delete, OAuth tokens, upload, settings, customer login landing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… test

A retail customer (ROLE_USER) logging in now lands on a self-service page
(/customer/authorizations) listing the third-party authorizations granted
against their data, with a Revoke action per authorization, instead of the
generic home page.

- CustomerAuthorizationController: GET /customer[/home|/authorizations] lists the
  current customer's authorizations (resolved by username; @transactional + flat
  view records since OSIV is off); POST /customer/authorizations/{id}/revoke sets
  status=REVOKED, ownership-checked so a customer can only revoke their own.
- Session/form-login chain now owns /customer/**; role-aware landing sends
  customers to /customer/authorizations (custodians still -> /custodian/home).
- customerHeader nav trimmed to the one migrated page (no dead links).
- New template customer/authorizations.html.
- Update CustomerLoginSecurityConfigurationTest: a customer now redirects to
  /customer/authorizations (was the stale hard-coded /custodian/home).

Full openespi-datacustodian suite: 160 tests, 0 failures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfcoffin dfcoffin merged commit 8ba93c2 into main Jun 7, 2026
4 checks passed
@dfcoffin dfcoffin deleted the fix/173-custodian-portal-restore branch June 7, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-activate Data Custodian admin portal dashboard (broken links + unreadable navbar)

1 participant