mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[PM-11343] Browser Refresh - View dialog permissions in AC (#11092)
* [PM-11343] Add param to conditionally disable the edit button * [PM-11343] Cleanup router navigation and move query param handling to callers of the View dialog * [PM-11343] Fix failing test * [PM-11343] Fix missing router after merge * [PM-11343] Add null checks in case the dialog result is undefined (due to closing via the ESC key) * [PM-11343] Add support to provide a list of collections to the cipher view component * [PM-11343] Add collections as an optional view cipher dialog parameter * [PM-11343] Update the org vault to provide collections when opening the View cipher dialog * [PM-11343] Fix import * [PM-11343] Use [replaceUrl] for cipher items to avoid needing double back button
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<app-item-details-v2
|
||||
[cipher]="cipher"
|
||||
[organization]="organization$ | async"
|
||||
[collections]="collections$ | async"
|
||||
[collections]="collections"
|
||||
[folder]="folder$ | async"
|
||||
>
|
||||
</app-item-details-v2>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, Input, OnDestroy, OnInit } from "@angular/core";
|
||||
import { Observable, Subject, takeUntil } from "rxjs";
|
||||
import { firstValueFrom, Observable, Subject, takeUntil } from "rxjs";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||
@@ -12,7 +12,7 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";
|
||||
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
|
||||
import { isCardExpired } from "@bitwarden/common/vault/utils";
|
||||
import { SearchModule, CalloutModule } from "@bitwarden/components";
|
||||
import { CalloutModule, SearchModule } from "@bitwarden/components";
|
||||
|
||||
import { AdditionalOptionsComponent } from "./additional-options/additional-options.component";
|
||||
import { AttachmentsV2ViewComponent } from "./attachments/attachments-v2-view.component";
|
||||
@@ -45,10 +45,15 @@ import { ViewIdentitySectionsComponent } from "./view-identity-sections/view-ide
|
||||
],
|
||||
})
|
||||
export class CipherViewComponent implements OnInit, OnDestroy {
|
||||
@Input() cipher: CipherView;
|
||||
@Input({ required: true }) cipher: CipherView;
|
||||
|
||||
/**
|
||||
* 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[];
|
||||
organization$: Observable<Organization>;
|
||||
folder$: Observable<FolderView>;
|
||||
collections$: Observable<CollectionView[]>;
|
||||
private destroyed$: Subject<void> = new Subject();
|
||||
cardIsExpired: boolean = false;
|
||||
|
||||
@@ -84,10 +89,16 @@ export class CipherViewComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
async loadCipherData() {
|
||||
if (this.cipher.collectionIds.length > 0) {
|
||||
this.collections$ = this.collectionService
|
||||
.decryptedCollectionViews$(this.cipher.collectionIds as CollectionId[])
|
||||
.pipe(takeUntil(this.destroyed$));
|
||||
// Load collections if not provided and the cipher has collectionIds
|
||||
if (
|
||||
this.cipher.collectionIds.length > 0 &&
|
||||
(!this.collections || this.collections.length === 0)
|
||||
) {
|
||||
this.collections = await firstValueFrom(
|
||||
this.collectionService.decryptedCollectionViews$(
|
||||
this.cipher.collectionIds as CollectionId[],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (this.cipher.organizationId) {
|
||||
|
||||
Reference in New Issue
Block a user