Skip to content

[CSM][BE][Web] Add SCIM external-account status to user profile; fix sidebar active tab on reload - #1421

Merged
Rashmika998 merged 1 commit into
wso2-open-operations:mainfrom
Rashmika998:feat/csm-scim-external-account-status
Aug 10, 2026
Merged

Rashmika998 merged 1 commit into
wso2-open-operations:mainfrom
Rashmika998:feat/csm-scim-external-account-status

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • GET /users/{id} now appends externalAccount (exists/locked) for external contacts, sourced from SCIM's "external" org search — same call pattern as infra-operations/operations/asgardeo-user-check. Best-effort: a SCIM failure logs a warning and leaves the rest of the response untouched, never failing the request.
  • UserProfilePage renders this as exists/locked chips in the Overview card (skipped for internal/WSO2 users, who live in the SCIM "internal" org instead) plus a locked-account alert on the Accessible projects card — the alert is informational only and does not hide the project-access table below it.
  • Unrelated fix bundled in: the sidebar was highlighting "Dashboard" after a hard refresh on any route with no owning nav section (e.g. a user profile at /people/:id, reachable from anywhere in the app and not owned by any section). The last-resolved section is now persisted to sessionStorage (mirroring the existing SIDEBAR_COLLAPSED_KEY pattern) instead of only living in a useRef that resets to a hardcoded default on every fresh mount.

Test plan

  • go build ./... && go vet ./... && go test ./... — all pass
  • gosec -fmt=text ./... — 0 issues in changed files (2 pre-existing, unrelated findings remain in internal/dashboard/registry.go)
  • tsc -b — clean
  • eslint on changed files — clean
  • vitest run — UserProfilePage.test.tsx (18 tests) and CsmSideBar.test.tsx (3 tests, including a direct regression test for the reload bug) all pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • User profiles now show external account existence and lock status when available.
    • Locked external accounts display an access warning.
    • External account checks are best-effort and do not prevent profiles from loading.
    • The sidebar remembers and restores the most recently selected section.
  • Bug Fixes

    • User and team profile details now remain available when supplementary lookups fail.
  • Documentation

    • Updated endpoint and profile documentation to describe external account information and availability.

… on reload

GET /users/{id} now appends externalAccount (exists/locked, from SCIM's
"external" org search) for external contacts, mirroring how
infra-operations/operations/asgardeo-user-check checks Asgardeo account
state. Rendered on UserProfilePage as chips in the Overview card plus a
locked-account alert; best-effort like the existing teams enrichment, so a
SCIM failure never fails the request.

Also fixes the sidebar highlighting "Dashboard" after a hard refresh on a
route with no owning nav section (e.g. a user profile at /people/:id): the
last-resolved section is now persisted to sessionStorage instead of only
living in a useRef that resets on every fresh mount.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9efd5117-7805-49d3-a730-6a203a76c497

📥 Commits

Reviewing files that changed from the base of the PR and between 80197ae and 87107ad.

📒 Files selected for processing (15)
  • apps/csm-portal/backend/CLAUDE.md
  • apps/csm-portal/backend/README.md
  • apps/csm-portal/backend/internal/handler/helpers_test.go
  • apps/csm-portal/backend/internal/handler/user_external_account.go
  • apps/csm-portal/backend/internal/handler/user_external_account_test.go
  • apps/csm-portal/backend/internal/handler/users.go
  • apps/csm-portal/backend/internal/scim/scim.go
  • apps/csm-portal/backend/internal/scim/types.go
  • apps/csm-portal/backend/openapi.yaml
  • apps/csm-portal/webapp/CLAUDE.md
  • apps/csm-portal/webapp/src/components/side-nav-bar/CsmSideBar.test.tsx
  • apps/csm-portal/webapp/src/components/side-nav-bar/CsmSideBar.tsx
  • apps/csm-portal/webapp/src/features/csm-users/pages/UserProfilePage.test.tsx
  • apps/csm-portal/webapp/src/features/csm-users/pages/UserProfilePage.tsx
  • apps/csm-portal/webapp/src/features/csm-users/types/csmUsers.ts

📝 Walkthrough

Walkthrough

The backend adds best-effort external SCIM account enrichment to user details. The web app displays account existence and lock status. The sidebar persists its last active section in session storage.

Changes

External account status

Layer / File(s) Summary
External SCIM lookup contract and implementation
apps/csm-portal/backend/internal/scim/*
The SCIM client searches the external organization and returns account existence with nullable lock status.
User endpoint enrichment
apps/csm-portal/backend/internal/handler/*, apps/csm-portal/backend/openapi.yaml, apps/csm-portal/backend/README.md, apps/csm-portal/backend/CLAUDE.md
GetUser enriches external profiles and preserves the original response when enrichment fails. The API schema and backend documentation describe the new field.
Profile status rendering
apps/csm-portal/webapp/src/features/csm-users/*
User-detail models propagate externalAccount. Profile pages render existence, lock, unavailable, and locked-access states with test coverage.

Sidebar section persistence

Layer / File(s) Summary
Persisted sidebar section
apps/csm-portal/webapp/src/components/side-nav-bar/*, apps/csm-portal/webapp/CLAUDE.md
The sidebar restores and updates csm.sidebar.lastSection in session storage, with dashboard fallback and storage-error handling. Tests cover route persistence and restoration.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: Type/New Feature, Type/Bug

Suggested reviewers: rksk

Sequence Diagram(s)

sequenceDiagram
  participant UserProfilePage
  participant GetUser
  participant SCIMClient
  participant ExternalOrganization

  UserProfilePage->>GetUser: Request user details
  GetUser->>SCIMClient: SearchExternalUser(email)
  SCIMClient->>ExternalOrganization: Search external organization
  ExternalOrganization-->>SCIMClient: User result and lock state
  SCIMClient-->>GetUser: ExternalUserInfo
  GetUser-->>UserProfilePage: User detail with externalAccount
  UserProfilePage-->>UserProfilePage: Render existence and lock status
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the feature and test results, but it omits most required template sections, including Purpose, Goals, Documentation, Security checks, and Test environment. Complete the repository template and provide entries for all required sections, including UI evidence, documentation impact, security checks, and test environment.
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both main changes: SCIM external-account status and the sidebar reload fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Rashmika998
Rashmika998 merged commit 6056303 into wso2-open-operations:main Aug 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants