Roo-Code/packages/cloud/src
Matt Rubens abaa3d8179
Store the organization id in credentials (#5002)
* Store the organization id in credentials

* Better organization logic

* Fix tests

* Update cloud settings defaults

* Fix organization_id handling in Clerk API calls

Address review feedback by properly handling 3 cases for organization_id:
1. Have an org id: send organization_id=THE_ORG_ID
2. Have a personal account: send organization_id= (empty string)
3. Don't know if you have an org id (old credentials): don't send organization_id param at all

Changes:
- Updated clerkCreateSessionToken() to check credentials.organizationId !== undefined
- Updated fetchUserInfo() to handle all 3 cases consistently
- Added fallback logic for old credentials without organization context
- Improved logging for better debugging of organization context

* DRY up organization loading code in AuthService

Extract common organization membership processing logic into reusable helper methods:

- findOrganizationMembership(): Find specific org membership by ID
- findPrimaryOrganizationMembership(): Get first/primary org membership
- setUserOrganizationInfo(): Set organization info on user object

This eliminates duplication between the two clerkGetOrganizationMemberships()
call sites that were doing very similar organization data processing.
2025-06-23 07:23:29 -04:00
..
__mocks__ cloud service cleanup (auth mostly) (#4539) 2025-06-19 12:29:02 -04:00
__tests__ Store the organization id in credentials (#5002) 2025-06-23 07:23:29 -04:00
AuthService.ts Store the organization id in credentials (#5002) 2025-06-23 07:23:29 -04:00
CloudService.ts Store the organization id in credentials (#5002) 2025-06-23 07:23:29 -04:00
Config.ts MDM check improvements (#4770) 2025-06-17 07:35:20 -04:00
index.ts Marketplace (#4538) 2025-06-11 17:28:12 -04:00
RefreshTimer.ts Roo Code Cloud (#4069) 2025-05-28 20:43:30 -07:00
SettingsService.ts It's compliant if you're on your first attempt to fetch a session token (#4957) 2025-06-20 16:06:35 -07:00
ShareService.ts Add choice to share with organization or publicly (#4899) 2025-06-19 22:29:42 -04:00
TelemetryClient.ts Add roo cloud settings (#4117) 2025-05-29 15:10:34 -07:00
types.ts Cloud: add auth logs to the output channel (#4270) 2025-06-02 16:56:27 -07:00
utils.ts Add a share button when logged into cloud (#4448) 2025-06-08 07:08:41 -07:00