Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-13360] Respect manage permission to assign collections #4190

Open
wants to merge 3 commits into
base: PM-12922/delete-collection-permission
Choose a base branch
from

Conversation

SaintPatrck
Copy link
Contributor

🎟️ Tracking

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

📔 Objective

This commit prevents users from assigning items to collections if the item is already in a read-only collection where the user does not have "manage" permission.

This change ensures that users with limited permissions cannot modify items in a way that violates the collection's access controls.

📸 Screenshots

Coming soon!

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation 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

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 20 lines in your changes missing coverage. Please review.

Please upload report for BASE (PM-12922/delete-collection-permission@9850607). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../ui/vault/feature/addedit/VaultAddEditViewModel.kt 35.71% 0 Missing and 9 partials ⚠️
...warden/ui/vault/feature/item/VaultItemViewModel.kt 40.00% 0 Missing and 9 partials ⚠️
...den/ui/vault/feature/addedit/VaultAddEditScreen.kt 80.00% 0 Missing and 1 partial ⚠️
...bitwarden/ui/vault/feature/item/VaultItemScreen.kt 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                           Coverage Diff                            @@
##             PM-12922/delete-collection-permission    #4190   +/-   ##
========================================================================
  Coverage                                         ?   89.03%           
========================================================================
  Files                                            ?      445           
  Lines                                            ?    38714           
  Branches                                         ?     5442           
========================================================================
  Hits                                             ?    34468           
  Misses                                           ?     2344           
  Partials                                         ?     1902           

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

…cResponseJson

This commit adds the `canManage` property to the `CollectionEntity` and `SyncResponseJson` classes to support the management of collections. It also includes necessary test updates and updates to the database schema to reflect these changes.
@SaintPatrck SaintPatrck force-pushed the PM-12922/delete-collection-permission branch 2 times, most recently from b935392 to 17d36f0 Compare October 29, 2024 22:24
Disables the delete button for items in collections where the user does not have "manage" permission.

This change ensures that users cannot delete items from collections they are not authorized to manage. It updates the UI to reflect the user's permissions and prevents accidental or unauthorized deletions.
@SaintPatrck SaintPatrck force-pushed the PM-12922/delete-collection-permission branch from 17d36f0 to 9850607 Compare October 29, 2024 22:25
This commit prevents users from assigning items to collections if the item is already in a read-only collection where the user does not have "manage" permission.

This change ensures that users with limited permissions cannot modify items in a way that violates the collection's access controls.
@SaintPatrck SaintPatrck force-pushed the PM-13360/collection-association-permission branch from 9d8e0f0 to 76954d4 Compare October 30, 2024 15:19
@SaintPatrck SaintPatrck force-pushed the PM-12922/delete-collection-permission branch 4 times, most recently from 4d2f1c2 to 70a7e99 Compare October 31, 2024 14:29
.takeUnless {
state.isAddItemMode ||
(!state.isCipherInCollection ||
!state.canAssociateToCollections)
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 these parenthesis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants