Skip to content

feat: Add collection management to Android#6717

Draft
dasien wants to merge 6 commits intomainfrom
android-collections
Draft

feat: Add collection management to Android#6717
dasien wants to merge 6 commits intomainfrom
android-collections

Conversation

@dasien
Copy link

@dasien dasien commented Mar 25, 2026

Summary

  • Add full CRUD support for managing collections on Android via Settings > Vault > Collections
  • Collections are organization-scoped vault items available on paid plans
  • Network layer: CollectionsApi, CollectionService with create/update/delete/get endpoints
  • Data layer: CollectionManager with encrypt → API → disk → decrypt flow
  • Permission model: expanded with collection-specific permission fields and role-based checks matching web client logic
  • UI: CollectionsScreen (list with org subtitles, permission-gated FAB), CollectionAddEditScreen (name field, save, delete)
  • Creating user automatically gets manage access on new collections
  • Update requests preserve existing group/user access permissions

Test plan

  • Log in with account that has a paid organization
  • Navigate to Settings > Vault > Collections
  • Verify FAB is visible for Owner/Admin roles
  • Create a new collection and verify snackbar confirmation
  • Move an item to the new collection (verify no permission error)
  • Edit a collection name and verify save works
  • Delete a collection and verify confirmation dialog and removal
  • Verify FAB is hidden for users without create permission
  • Verify / character is rejected in collection name

Notes

  • SDK encryptCollection requires a local SDK build from sdk-internal with collection encryption support (not yet in published SDK)
  • Commit 27eab557 adapts to local SDK API changes for development; will need adjustment when official SDK is bumped
  • Requirements doc at docs/COLLECTIONS_REQUIREMENTS.md
  • Implementation plan at .claude/outputs/plans/COLLECTION-MANAGEMENT-PLAN.md

anonymous and others added 5 commits March 24, 2026 15:09
…Vault

Add full CRUD support for managing collections on Android, accessible
via Settings > Vault > Collections. Collections are organization-scoped
vault items available on paid plans.

Changes include:
- Network layer: CollectionsApi, CollectionService, request/response models
- Data layer: CollectionManager with encrypt > API > disk > decrypt flow
- Permission model: expanded SyncResponseJson.Permissions and Organization
  with collection-specific permission fields
- UI: CollectionsScreen (list with org subtitles, permission-gated FAB),
  CollectionAddEditScreen (name field, save, delete with confirmation)
- Navigation: type-safe routes wired through VaultSettings entry point
- VaultDiskSource.deleteCollection and VaultSdkSource.encryptCollection stub

Note: encryptCollection is stubbed pending SDK release (SDK changes are
implemented but not yet published). Create/update will fail at runtime
until the SDK is updated.
Remove the UnsupportedOperationException stub and delegate to the
actual SDK collections().encrypt() method. Requires SDK version with
collection encryption support (not yet in published 2.0.0-5451).
Add vaultUrl parameter to SsoCookieVendorConfig and handle new
KeyConnectorUrl variant in InitUserCryptoMethod when expressions.
These changes are required for compatibility with the latest
sdk-internal build used for local collection encryption testing.
The PUT endpoint for updating a collection requires groups and users
access permissions in the request body. Previously only the encrypted
name was sent, causing the server to reject the request with "At least
one member or group must have can manage permission."

The update flow now fetches collection details via the new /details
endpoint before sending the PUT request, echoing back existing groups,
users, and externalId. Also fixes collection edit screen passing
organizationName instead of organizationId and resolves compile errors
from new parameters across tests.
- Add organizationUserId to SyncResponseJson and Organization domain
  model to identify the current user's org membership ID
- Include creating user with manage access in collection create request,
  matching web client behavior
- Add limitCollectionCreation/limitCollectionDeletion to org model
- Fix FAB visibility: use canManageCollections computed property that
  checks role (Owner/Admin) in addition to permissions flags, matching
  web client logic: !limitCollectionCreation || isAdmin || permissions
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:docs Change Type - Documentation t:feature Change Type - Feature Development t:llm Change Type - LLM related change (e.g. CLAUDE.md files) labels Mar 25, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

Logo
Checkmarx One – Scan Summary & Detailsf6f86439-4ba7-4700-bf72-94bdbe2cf40b

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

Code review fixes:
- Remove duplicate KeyConnectorUrl branch in InitUserCryptoMethodExtensions
- Fix CollectionManagerTest createCollection calls to include organizationUserId
- Prevent vault sync from overwriting user's in-progress edits in
  CollectionAddEditViewModel (early return if already in Content state)
- Add per-collection canManage permission check before allowing edit
  navigation, based on collection manage flag and org role
- Gitignore .claude/outputs/ to exclude plan documents from commits

New tests:
- CollectionsViewModelTest: 11 tests covering navigation, state updates,
  FAB visibility based on permissions, snackbar relay, and error states
- CollectionAddEditViewModelTest: 20 tests covering create/edit/delete
  flows, name validation, dialog states, snackbar relay, and the sync
  overwrite protection fix

Updated test fixtures:
- SyncResponseProfileUtil: add organizationUserId, limitCollectionCreation,
  limitCollectionDeletion fields
@github-actions github-actions bot removed the t:llm Change Type - LLM related change (e.g. CLAUDE.md files) label Mar 25, 2026
),
)
}
return vaultSdkSource
Copy link
Contributor

Choose a reason for hiding this comment

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

Thought: Encrypt-only in SDK was really only meant as a transition phase while API, state were not mature in the SDK, and the expectation is to move state and API to the SDK too. In this case, moving at least API one layer down into the SDK would already reduce this PR by a large margin, and remove redundant work from the corresponding iOS PR and would allow dropping TS clients code.

Given that this is a net new feature, can we consider just moving this functionality into the SDK in the first place instead of duplicating logic? Moving this down later will cause more effort overall compared to doing it here.

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:docs Change Type - Documentation t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants