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-7883] Fix Collection Dialog Component #9088
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add new limitNestedCollections option - Remove redundant calls to collectionService and collectionAdminService - Adjust deleted parent logic to account for users that cannot ViewAllCollections
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9088 +/- ##
=======================================
Coverage 27.78% 27.79%
=======================================
Files 2422 2422
Lines 70235 70233 -2
Branches 13097 13096 -1
=======================================
+ Hits 19518 19521 +3
+ Misses 49197 49192 -5
Partials 1520 1520 ☔ View full report in Codecov by Sentry. |
No New Or Fixed Issues Found |
…iting nested collections in the org vault
Jingo88
previously approved these changes
May 8, 2024
Jingo88
approved these changes
May 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Objective
The Collection Dialog component had some ambiguous/outdated logic surrounding the nested collection dropdown that wasn't being used by consuming Vault components properly. Users should only be able to nest a collection they
CanManage
under other collections that they haveCanManage
access to. This should always be the default behavior for the Individual Vault and only apply to Org Vault when the user does not have permission to edit any collection (depends on V1 flag and collection management setting).Code changes
Filtering Nested Collections
The
collectionIds
dialog param would filter the available collections to nest based on what was passed in via the parent Vault component. Instead of having each Vault determine what collections to filter, I moved that logic internal to the dialog as it now has all that information available due to bitwarden/server#3793.To accomplish this, I opted to introduce a new
limitNestedCollections
option that would be responsible for applying the filtering. This is always set to true for the Individual Vault and only true for the Org Vault when the user does not have permission to edit any collection (depends on V1 flag and collection management setting).Service and API request Cleanup
We have normally needed to marry up collection sync data with the admin collection data in order to determine the acting users permissions for a given collection. However, now that its available directly from the admin endpoints I was able to remove the additional calls to the
collectionService
and the extracollectionAdminService
call for the specific collection.Dealing with Restricted/Deleted Parent Collections
Normally, if an existing parent collection was not found in the list of all collections, it was presumed the collection was deleted and it was marked as so in the dropdown (with a
(deleted)
suffix). Unfortunately, we can no longer always assume this because a non-admin user may simply not have access to the parent collection.Logic was added to better determine if the existing parent collection was deleted versus just hidden/unknown. If hidden/unknown, a fake parent option is added to the list of nest options to prevent the user from inadvertently overwriting the parent assignment.
Before you submit