-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-11343] Browser Refresh - View dialog permissions in AC #11092
[PM-11343] Browser Refresh - View dialog permissions in AC #11092
Conversation
@@ -622,10 +622,6 @@ export class VaultComponent implements OnInit, OnDestroy { | |||
component.folderId = this.activeFilter.folderId; | |||
} | |||
|
|||
async navigateToCipher(cipher: CipherView) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ This was not used anywhere.
@@ -137,13 +139,6 @@ export class ViewComponent implements OnInit, OnDestroy { | |||
*/ | |||
async edit(): Promise<void> { | |||
this.dialogRef.close({ action: ViewCipherDialogResult.edited }); | |||
await this.router.navigate([], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Letting the calling component handle the router makes it easier to share the component between the AC and Individual Vault. (e.g. the AC does not need to update the organizationId
parameter). Also, should we ever move away from requiring navigation to open the dialogs, this is one less place to track.
No New Or Fixed Issues Found |
…43/view-dialog-edit-button-permissions
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #11092 +/- ##
==========================================
- Coverage 35.08% 35.07% -0.01%
==========================================
Files 2709 2710 +1
Lines 84531 84545 +14
Branches 16068 16068
==========================================
Hits 29655 29655
- Misses 53905 53919 +14
Partials 971 971 ☔ View full report in Codecov by Sentry. |
…43/view-dialog-edit-button-permissions
…43/view-dialog-edit-button-permissions
fe5d3c0
to
2bdd14a
Compare
…e to closing via the ESC key)
…he View cipher dialog
@@ -21,6 +21,7 @@ | |||
[routerLink]="[]" | |||
[queryParams]="{ itemId: cipher.id, action: extensionRefreshEnabled ? 'view' : null }" | |||
queryParamsHandling="merge" | |||
[replaceUrl]="extensionRefreshEnabled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ This fixes a problem where after closing a dialog, you'd have to hit the browser's back button twice to actually navigate back. The same problem exists in production currently, but its behind the flag in case it introduces unexpected behavior in the old modals.
* Optional list of collections the cipher is assigned to. If none are provided, they will be fetched using the | ||
* `CipherService` and the `collectionIds` property of the cipher. | ||
*/ | ||
@Input() collections: CollectionView[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ This override is necessary because in the Admin console, an admin might not have "normal" access to a cipher and its collections. When this happens the collectionService.decryptedCollectionViews$
will return empty so the Admin Console needs a means to provide collections it has retrieved via the Admin endpoints.
) { | ||
// didn't pass password prompt, so don't open add / edit modal. | ||
async viewCipher(cipher: CipherView, collections: CollectionView[] = []) { | ||
if (!cipher) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Updated to use view objects instead of Ids to avoid needing to refetch the cipher and collection via admin endpoints. The component already handles determining which ciphers/collections a user has access to in the observable setup above, so instead of re-implementing that here and making more API requests, we just accept the view objects themselves.
…43/view-dialog-edit-button-permissions
…43/view-dialog-edit-button-permissions
🎟️ Tracking
PM-11343 - Edit button never available in Individual Vault
PM-11346 - Edit button not available to admins with permissions to edit all items
PM-11337 - Unable to open view dialog for items belonging to Unassigned or collections not assigned to
📔 Objective
Update the View dialog to support the unique behavior of the AC which has different data loading strategies for items/collections that are only applicable to admins.
The "Edit" button should always be enabled when viewing a cipher in the Individual Vault as that is the only way to Favorite an item or move it to a new folder. When in the AC, the "Edit" button can be disabled if the user does not have edit permissions as users are not expected to interact with favorites/folders in the AC.
The AC must explicitly override the collections for items they do not normally have access to so that they can be rendered in the Cipher View component.
📸 Screenshots
Edit buttons in Individual Vault and AC
Screen.Recording.2024-09-16.at.4.37.51.PM.mov
Accessing Unassigned items
Screen.Recording.2024-09-18.at.12.19.13.PM.mov
⏰ Reminders before review
🦮 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