[PR #5357] [MERGED] [PM-19309] Handle restrict item types policy #5698

Closed
opened 2025-11-27 00:12:48 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/5357
Author: @andrebispo5
Created: 6/13/2025
Status: Merged
Merged: 6/25/2025
Merged by: @andrebispo5

Base: mainHead: pm-19309/remove-card-policy


📝 Commits (10+)

  • 2ae71b9 [PM-19309] Add ´pm-16442-remove-card-item-type-policy´ feature flag
  • 8f2c80c [PM-19309] Handle new restrict item types policy model.
  • 44b2ea9 [PM-19309] Apply restrict item types policy to VaultDataExtensions and VaultItemListingDataExtensions.
  • 84f4595 [PM-19309] Update card option visibility based on policy. Tests.
  • 4d61bf8 [PM-19309] VaultViewModel policy updates. Tests.
  • 65ee5b2 [PM-19309] Add policy to VaultItemListingViewModel. Tests.
  • 56ae303 Merge branch 'main' into pm-19309/remove-card-policy
  • 7ee8d90 [PM-19309] Fix bug where feature flag was enabled but there were no remove item types policy enable.
  • 5e99f2d [PM-19309] Add missing tests
  • ad82183 [PM-19309] Hide create card button when policy is enable and card listing becomes empty.

📊 Changes

19 files changed (+869 additions, -41 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt (+10 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt (+2 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingViewModel.kt (+78 -11)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensions.kt (+8 -6)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultContent.kt (+17 -15)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt (+2 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt (+63 -3)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt (+30 -2)
📝 app/src/main/res/values/strings_non_localized.xml (+1 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FlagKeyTest.kt (+5 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt (+2 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreenTest.kt (+1 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingViewModelTest.kt (+177 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensionsTest.kt (+128 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreenTest.kt (+80 -2)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt (+112 -1)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensionsTest.kt (+146 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultStateExtensionsTest.kt (+1 -0)
📝 network/src/main/kotlin/com/bitwarden/network/model/PolicyTypeJson.kt (+6 -0)

📄 Description

🎟️ Tracking

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

📔 Objective

When the policy is turned on:

  • The policy will be applied to the organization’s and individual vault
  • Items of the card item type will be hidden (not deleted)
  • The card item group will be hidden
  • The card option in creating a new item will be hidden
  • If the policy is turned on and off again, the card items will re-appear.

If the user is part of multiple organizations, and only 1 (or more) organizations have turned on the policy and 1 (or more) organizations have turned off the policy:
All of the above requirements apply, except:

  • Users can continue to access and edit card item types that are stored in organizations with the policy turned off
  • The card group will appear if users have card items stored in a collection for an organization with the policy turned off

📸 Screenshots

Hide cards from individual and org with policy:

https://github.com/user-attachments/assets/8f779ef5-a41e-48f8-b3fb-8757d97abbdf

Hide card group and add card from float button:

https://github.com/user-attachments/assets/9cfe83ad-9531-4b8e-a76c-c75fdf609a65

Hide create card buttons when listing becomes empty and policy is enabled:

https://github.com/user-attachments/assets/ac14e58c-dec4-4ee2-8b2e-d732deba1f8f

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/5357 **Author:** [@andrebispo5](https://github.com/andrebispo5) **Created:** 6/13/2025 **Status:** ✅ Merged **Merged:** 6/25/2025 **Merged by:** [@andrebispo5](https://github.com/andrebispo5) **Base:** `main` ← **Head:** `pm-19309/remove-card-policy` --- ### 📝 Commits (10+) - [`2ae71b9`](https://github.com/bitwarden/android/commit/2ae71b91fee85d5715fecba0223854af2e551ba7) [PM-19309] Add ´pm-16442-remove-card-item-type-policy´ feature flag - [`8f2c80c`](https://github.com/bitwarden/android/commit/8f2c80c6ea40c10ffb4ab99aa5180512ffdedc58) [PM-19309] Handle new restrict item types policy model. - [`44b2ea9`](https://github.com/bitwarden/android/commit/44b2ea9709c65cdf110ed6b5da58f44350cc0d97) [PM-19309] Apply restrict item types policy to VaultDataExtensions and VaultItemListingDataExtensions. - [`84f4595`](https://github.com/bitwarden/android/commit/84f4595dd595702878105d2a3847e4e956823761) [PM-19309] Update card option visibility based on policy. Tests. - [`4d61bf8`](https://github.com/bitwarden/android/commit/4d61bf89508146e113cfb16c64161d8c150efef7) [PM-19309] VaultViewModel policy updates. Tests. - [`65ee5b2`](https://github.com/bitwarden/android/commit/65ee5b2ec4b2823e51190f5763db38fd879f95a9) [PM-19309] Add policy to VaultItemListingViewModel. Tests. - [`56ae303`](https://github.com/bitwarden/android/commit/56ae30366b60b0d8a0ff85b5854be30be561dfea) Merge branch 'main' into pm-19309/remove-card-policy - [`7ee8d90`](https://github.com/bitwarden/android/commit/7ee8d901631482ae59e1839b676d20f2e6f4fbf7) [PM-19309] Fix bug where feature flag was enabled but there were no remove item types policy enable. - [`5e99f2d`](https://github.com/bitwarden/android/commit/5e99f2d92a9626941d9a1a265135b567d74be3a2) [PM-19309] Add missing tests - [`ad82183`](https://github.com/bitwarden/android/commit/ad821832bc31ab8431e7d69a8dde76464d52ccd6) [PM-19309] Hide create card button when policy is enable and card listing becomes empty. ### 📊 Changes **19 files changed** (+869 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt` (+10 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt` (+2 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingViewModel.kt` (+78 -11) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensions.kt` (+8 -6) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultContent.kt` (+17 -15) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt` (+2 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt` (+63 -3) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt` (+30 -2) 📝 `app/src/main/res/values/strings_non_localized.xml` (+1 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/FlagKeyTest.kt` (+5 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt` (+2 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreenTest.kt` (+1 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingViewModelTest.kt` (+177 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensionsTest.kt` (+128 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreenTest.kt` (+80 -2) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt` (+112 -1) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensionsTest.kt` (+146 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultStateExtensionsTest.kt` (+1 -0) 📝 `network/src/main/kotlin/com/bitwarden/network/model/PolicyTypeJson.kt` (+6 -0) </details> ### 📄 Description ## 🎟️ Tracking <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> https://bitwarden.atlassian.net/browse/PM-19309 ## 📔 Objective <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. --> When the policy is turned on: - The policy will be applied to the organization’s and individual vault - Items of the card item type will be hidden (not deleted) - The card item group will be hidden - The card option in creating a new item will be hidden - If the policy is turned on and off again, the card items will re-appear. If the user is part of multiple organizations, and only 1 (or more) organizations have turned on the policy and 1 (or more) organizations have turned off the policy: All of the above requirements apply, except: - Users can continue to access and edit card item types that are stored in organizations with the policy turned off - The card group will appear if users have card items stored in a collection for an organization with the policy turned off ## 📸 Screenshots <!-- Required for any UI changes; delete if not applicable. Use fixed width images for better display. --> Hide cards from individual and org with policy: https://github.com/user-attachments/assets/8f779ef5-a41e-48f8-b3fb-8757d97abbdf Hide card group and add card from float button: https://github.com/user-attachments/assets/9cfe83ad-9531-4b8e-a76c-c75fdf609a65 Hide create card buttons when listing becomes empty and policy is enabled: https://github.com/user-attachments/assets/ac14e58c-dec4-4ee2-8b2e-d732deba1f8f ## ⏰ 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 <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-27 00:12:48 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#5698