1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 17:53:39 +00:00

[PM-24232] - [Defect][Web] Admin Console - SSH key and Folder should not show as options from New button (#15834)

* properly call input functions

* don't enable sshkey form

* fix logic for disabling cipher form

* prefer use of observable

* use destroyRef. change to enabled status only
This commit is contained in:
Jordan Aasen
2025-07-30 12:15:59 -07:00
committed by GitHub
parent 5dae5267d9
commit 1c5095806f
6 changed files with 32 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
<ng-container *ngIf="canCreateCipher || canCreateCollection || canCreateFolder">
<ng-container *ngIf="canCreateCipher() || canCreateCollection() || canCreateFolder()">
<div>
<button
bitButton
@@ -18,13 +18,13 @@
{{ item.labelKey | i18n }}
</button>
}
<bit-menu-divider *ngIf="canCreateCipher"></bit-menu-divider>
<button *ngIf="canCreateFolder" type="button" bitMenuItem (click)="folderAdded.emit()">
<bit-menu-divider *ngIf="canCreateCipher()"></bit-menu-divider>
<button *ngIf="canCreateFolder()" type="button" bitMenuItem (click)="folderAdded.emit()">
<i class="bwi bwi-fw bwi-folder" aria-hidden="true"></i>
{{ "folder" | i18n }}
</button>
<button
*ngIf="canCreateCollection"
*ngIf="canCreateCollection()"
type="button"
bitMenuItem
(click)="collectionAdded.emit()"

View File

@@ -18,6 +18,7 @@ export class NewCipherMenuComponent {
canCreateCipher = input(false);
canCreateFolder = input(false);
canCreateCollection = input(false);
canCreateSshKey = input(false);
folderAdded = output();
collectionAdded = output();
cipherAdded = output<CipherType>();
@@ -30,6 +31,9 @@ export class NewCipherMenuComponent {
cipherMenuItems$ = this.restrictedItemTypesService.restricted$.pipe(
map((restrictedTypes) => {
return CIPHER_MENU_ITEMS.filter((item) => {
if (!this.canCreateSshKey() && item.type === CipherType.SshKey) {
return false;
}
return !restrictedTypes.some((restrictedType) => restrictedType.cipherType === item.type);
});
}),