mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-09 19:28:06 +01:00
[PM-9953][PM-9963] Collections Reprompt and Org assignment (#10194)
* prompt for master password for assigning-collections * only pass collections that are within the cipher's org * remove type=button on anchor element
This commit is contained in:
parent
f96a66ebd9
commit
7594ebead2
@ -66,10 +66,21 @@ export class AssignCollections {
|
||||
combineLatest([$cipher, this.collectionService.decryptedCollections$])
|
||||
.pipe(takeUntilDestroyed(), first())
|
||||
.subscribe(([cipherView, collections]) => {
|
||||
let availableCollections = collections.filter((c) => !c.readOnly);
|
||||
const organizationId = (cipherView?.organizationId as OrganizationId) ?? null;
|
||||
|
||||
// If the cipher is already a part of an organization,
|
||||
// only show collections that belong to that organization
|
||||
if (organizationId) {
|
||||
availableCollections = availableCollections.filter(
|
||||
(c) => c.organizationId === organizationId,
|
||||
);
|
||||
}
|
||||
|
||||
this.params = {
|
||||
ciphers: [cipherView],
|
||||
organizationId: (cipherView?.organizationId as OrganizationId) ?? null,
|
||||
availableCollections: collections.filter((c) => !c.readOnly),
|
||||
organizationId,
|
||||
availableCollections,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -28,12 +28,7 @@
|
||||
<a routerLink="" bitMenuItem (click)="clone()">
|
||||
{{ "clone" | i18n }}
|
||||
</a>
|
||||
<a
|
||||
routerLink="/assign-collections"
|
||||
[queryParams]="{ cipherId: this.cipher.id }"
|
||||
type="button"
|
||||
bitMenuItem
|
||||
>
|
||||
<a bitMenuItem (click)="conditionallyNavigateToAssignCollections()">
|
||||
{{ "assignToCollections" | i18n }}
|
||||
</a>
|
||||
</ng-container>
|
||||
|
@ -152,4 +152,15 @@ export class ItemMoreOptionsComponent {
|
||||
} as AddEditQueryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/** Prompts for password when necessary then navigates to the assign collections route */
|
||||
async conditionallyNavigateToAssignCollections() {
|
||||
if (this.cipher.reprompt && !(await this.passwordRepromptService.showPasswordPrompt())) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.router.navigate(["/assign-collections"], {
|
||||
queryParams: { cipherId: this.cipher.id },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user