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$])
|
combineLatest([$cipher, this.collectionService.decryptedCollections$])
|
||||||
.pipe(takeUntilDestroyed(), first())
|
.pipe(takeUntilDestroyed(), first())
|
||||||
.subscribe(([cipherView, collections]) => {
|
.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 = {
|
this.params = {
|
||||||
ciphers: [cipherView],
|
ciphers: [cipherView],
|
||||||
organizationId: (cipherView?.organizationId as OrganizationId) ?? null,
|
organizationId,
|
||||||
availableCollections: collections.filter((c) => !c.readOnly),
|
availableCollections,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,7 @@
|
|||||||
<a routerLink="" bitMenuItem (click)="clone()">
|
<a routerLink="" bitMenuItem (click)="clone()">
|
||||||
{{ "clone" | i18n }}
|
{{ "clone" | i18n }}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a bitMenuItem (click)="conditionallyNavigateToAssignCollections()">
|
||||||
routerLink="/assign-collections"
|
|
||||||
[queryParams]="{ cipherId: this.cipher.id }"
|
|
||||||
type="button"
|
|
||||||
bitMenuItem
|
|
||||||
>
|
|
||||||
{{ "assignToCollections" | i18n }}
|
{{ "assignToCollections" | i18n }}
|
||||||
</a>
|
</a>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@ -152,4 +152,15 @@ export class ItemMoreOptionsComponent {
|
|||||||
} as AddEditQueryParams,
|
} 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