Skip to content

Conversation

@aj-rosado
Copy link
Contributor

@aj-rosado aj-rosado commented Jan 20, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-28470

📔 Objective

Added new Revoke from Organization endpoint, replaced leaveOrganization with RevokeFromOrganization endpoint.
Wired navigation from MigrateToMyItemsViewModel to the LeaveOrganizationViewModel

AuthenticatedOrganizationApi.kt - Added revokeFromOrganization endpoint
OrganizationService.kt - Added service interface method
OrganizationServiceImpl.kt - Added service implementation
AuthRepository.kt - Added revokeFromOrganization interface method
AuthRepositoryImpl.kt - Added repository implementation (no longer has leaveOrganization removed - both exist!)
VaultMigrationManager.kt - Added clearMigrationState() method
VaultMigrationManagerImpl.kt - Implemented clearMigrationState()
LeaveOrganizationViewModel.kt - Calls clearMigrationState() on success
MigrateToMyItemsViewModel.kt - Removed unused OrganizationService dependency
MigrateToMyItemsScreen.kt - Updated callback signature to accept org params
MigrateToMyItemsNavigation.kt - Updated destination signature
VaultUnlockedNavigation.kt - Wired up navigation to LeaveOrganization with params
VaultMigrationManagerTest.kt - Added test for clearMigrationState()
LeaveOrganizationViewModelTest.kt - Added verification for state clearing
MigrateToMyItemsViewModelTest.kt - Fixed event structure tests
MigrateToMyItemsScreenTest.kt - Updated callback signatures

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

aj-rosado and others added 4 commits January 20, 2026 12:27
Add new endpoint to revoke user's membership from organization.
This endpoint will be used when users decline vault migration
and choose to leave the organization.

- Add revokeFromOrganization to AuthenticatedOrganizationApi
- Add service method to OrganizationService
- Add repository method to AuthRepository

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@aj-rosado aj-rosado requested review from a team and david-livefront as code owners January 20, 2026 12:37
@aj-rosado aj-rosado added the ai-review Request a Claude code review label Jan 20, 2026
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:misc Change Type - ¯\_(ツ)_/¯ and removed ai-review Request a Claude code review labels Jan 20, 2026
@aj-rosado aj-rosado changed the title Pm 28470/add revoke from organization [PM-28470] Implement revoke from organization Jan 20, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

Logo
Checkmarx One – Scan Summary & Detailsc476a8b8-fee7-40f9-94a9-9aa7ea7753ea

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.52%. Comparing base (27a0f51) to head (74ef1ef).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...twarden/data/auth/repository/AuthRepositoryImpl.kt 0.00% 3 Missing ⚠️
...twarden/network/service/OrganizationServiceImpl.kt 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6383    +/-   ##
========================================
  Coverage   85.51%   85.52%            
========================================
  Files         764      764            
  Lines       55174    55309   +135     
  Branches     7991     8016    +25     
========================================
+ Hits        47182    47301   +119     
- Misses       5232     5239     +7     
- Partials     2760     2769     +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

collectionIds = listOfNotNull(defaultUserCollection.id),
).getOrElse { return MigratePersonalVaultResult.Failure(it) }

mutableVaultMigrationDataStateFlow.update { VaultMigrationData.NoMigrationRequired }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there another spot that can be updated with this function call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understood your question, we need to update the StateFlow on migration and on leaveOrganization (and when user is trying to do this operation but is offline)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if there are other places in this file that can use the new helper method?

*/
suspend fun revokeFromOrganization(
organizationId: String,
): LeaveOrganizationResult
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a different result for this?

What is the actual difference between leaving an org and revoking yourself from an org?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are different, leaving an org you are out of the org, you need to be reinvited.
Revoking an user, they do not have access to anything related to the org but admins can restore their access immediately.
And it should has a different result, it was an oversight.

)

@Suppress("MaxLineLength")
override suspend fun revokeFromOrganization(organizationId: String): RevokeFromOrganizationResult =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this suppression if you format this line.

override suspend fun revokeFromOrganization(
    organizationId: String,
): RevokeFromOrganizationResult =


if (personalCiphers.isEmpty()) {
mutableVaultMigrationDataStateFlow.update { VaultMigrationData.NoMigrationRequired }
clearMigrationState()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:misc Change Type - ¯\_(ツ)_/¯

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants