Skip to content

[PM-13349] Hide edit button unless item is in at least one non-readOnly collection #4430

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

Merged
merged 10 commits into from
Jan 6, 2025

Conversation

mpbw2
Copy link
Contributor

@mpbw2 mpbw2 commented Dec 6, 2024

Hide edit button unless item is in at least one non-readOnly collection

🎟️ Tracking

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

📔 Objective

Hide the edit button (FAB) if an item is in a readOnly collection, or in the case of multiple collections at least one has to be non-readOnly or the button remains hidden.

📸 Screenshots

Item view from within non-readOnly (editable) collection:

Screenshot 2024-12-06 at 4 33 20 PM

Item view from within readOnly (non-editable) collection:

Screenshot 2024-12-06 at 4 32 54 PM

⏰ 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
Contributor

github-actions bot commented Dec 6, 2024

Logo
Checkmarx One – Scan Summary & Detailse5667010-199e-4a0d-a9df-eed4547d773e

No New Or Fixed Issues Found

SaintPatrck
SaintPatrck previously approved these changes Dec 9, 2024
Copy link
Member

@eliykat eliykat left a comment

Choose a reason for hiding this comment

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

The server evaluates this business logic for you and sets the result in the cipher.edit property.

  • true if the user can edit the item
  • false if the item is read-only

This takes into account whether it's in the user's individual vault vs. organization (and if organization, what collection permissions apply).

I'm not familiar with mobile, but it looks like it's available on the SDK model: https://github.com/bitwarden/sdk-internal/blob/main/crates/bitwarden-vault/src/cipher/cipher.rs#L82

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.

Project coverage is 88.86%. Comparing base (8bde874) to head (f566b45).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...warden/ui/vault/feature/item/VaultItemViewModel.kt 37.50% 0 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4430      +/-   ##
==========================================
- Coverage   88.87%   88.86%   -0.02%     
==========================================
  Files         460      460              
  Lines       39899    39907       +8     
  Branches     5685     5690       +5     
==========================================
+ Hits        35462    35465       +3     
  Misses       2457     2457              
- Partials     1980     1985       +5     

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

@mpbw2
Copy link
Contributor Author

mpbw2 commented Dec 20, 2024

The server evaluates this business logic for you and sets the result in the cipher.edit property.

Thanks for the heads up on this @eliykat

@mpbw2 mpbw2 requested a review from SaintPatrck December 20, 2024 19:30
SaintPatrck
SaintPatrck previously approved these changes Jan 6, 2025
@mpbw2 mpbw2 added this pull request to the merge queue Jan 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 6, 2025
@mpbw2 mpbw2 added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit b958734 Jan 6, 2025
8 checks passed
@mpbw2 mpbw2 deleted the pm-13349/prevent-edit-readonly-collection branch January 6, 2025 18:22
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.

3 participants