From 9b3c28fcea94537c2cbe9c2612f6b517df14b33b Mon Sep 17 00:00:00 2001 From: Brandon Treston Date: Wed, 2 Apr 2025 12:49:08 -0400 Subject: [PATCH 01/16] [PM-19746] Add new permission check to browser (#14075) * add new permisssions check to browser * add permission logic to view * fix tests * cleanup * fix permissions model for CLI and desktop * feedback --- .../vault-v2/view-v2/view-v2.component.html | 8 ++++-- .../view-v2/view-v2.component.spec.ts | 4 ++- .../vault-v2/view-v2/view-v2.component.ts | 24 +++++++++++++++-- .../trash-list-items-container.component.html | 9 ++++++- .../trash-list-items-container.component.ts | 5 ++++ apps/cli/src/commands/restore.command.ts | 27 +++++++++++++++++-- apps/cli/src/oss-serve-configurator.ts | 2 ++ apps/cli/src/vault.program.ts | 2 ++ .../src/vault/app/vault/view.component.html | 2 +- .../src/vault/app/vault/view.component.ts | 6 +++++ .../src/vault/components/view.component.ts | 2 ++ 11 files changed, 82 insertions(+), 9 deletions(-) diff --git a/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.html b/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.html index c2645f15ea8..b7ffeb89cc1 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.html +++ b/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.html @@ -5,7 +5,7 @@ - + - + diff --git a/apps/desktop/src/vault/app/vault/view.component.ts b/apps/desktop/src/vault/app/vault/view.component.ts index aee1f34437b..9ddf18fff93 100644 --- a/apps/desktop/src/vault/app/vault/view.component.ts +++ b/apps/desktop/src/vault/app/vault/view.component.ts @@ -17,8 +17,10 @@ import { EventCollectionService } from "@bitwarden/common/abstractions/event/eve import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { TokenService } from "@bitwarden/common/auth/abstractions/token.service"; import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service"; import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @@ -70,6 +72,7 @@ export class ViewComponent extends BaseViewComponent implements OnInit, OnDestro accountService: AccountService, toastService: ToastService, cipherAuthorizationService: CipherAuthorizationService, + private configService: ConfigService, ) { super( cipherService, @@ -99,6 +102,9 @@ export class ViewComponent extends BaseViewComponent implements OnInit, OnDestro cipherAuthorizationService, ); } + + protected limitItemDeletion$ = this.configService.getFeatureFlag$(FeatureFlag.LimitItemDeletion); + ngOnInit() { super.ngOnInit(); diff --git a/libs/angular/src/vault/components/view.component.ts b/libs/angular/src/vault/components/view.component.ts index a2285e6a835..0e980bf66d1 100644 --- a/libs/angular/src/vault/components/view.component.ts +++ b/libs/angular/src/vault/components/view.component.ts @@ -59,6 +59,7 @@ export class ViewComponent implements OnDestroy, OnInit { @Output() onRestoredCipher = new EventEmitter(); canDeleteCipher$: Observable; + canRestoreCipher$: Observable; cipher: CipherView; showPassword: boolean; showPasswordCount: boolean; @@ -159,6 +160,7 @@ export class ViewComponent implements OnDestroy, OnInit { this.canDeleteCipher$ = this.cipherAuthorizationService.canDeleteCipher$(this.cipher, [ this.collectionId as CollectionId, ]); + this.canRestoreCipher$ = this.cipherAuthorizationService.canRestoreCipher$(this.cipher); if (this.cipher.folderId) { this.folder = await ( From 3c83165b4eecaa49781bb86649d9ecc161805627 Mon Sep 17 00:00:00 2001 From: Nick Krantz <125900171+nick-livefront@users.noreply.github.com> Date: Wed, 2 Apr 2025 11:58:31 -0500 Subject: [PATCH 02/16] [PM-17598] Long custom fields (#13668) * add custom directive to use the angular CDK resize textarea directive * swap to textarea to allow for full content to be shown when view text or hidden custom fields * add text-field styling to web sass file * move angular import to CL scss file * add `textarea` to selector to enforce directive usage only on textareas --- apps/web/src/scss/styles.scss | 1 + libs/components/src/tw-theme.css | 1 + .../custom-fields-v2.component.html | 24 +++++++++++-- .../custom-fields-v2.component.ts | 14 +++++++- .../readonly-textarea.directive.spec.ts | 34 +++++++++++++++++++ .../directives/readonly-textarea.directive.ts | 29 ++++++++++++++++ 6 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 libs/vault/src/directives/readonly-textarea.directive.spec.ts create mode 100644 libs/vault/src/directives/readonly-textarea.directive.ts diff --git a/apps/web/src/scss/styles.scss b/apps/web/src/scss/styles.scss index d17181615ca..e2b764e45af 100644 --- a/apps/web/src/scss/styles.scss +++ b/apps/web/src/scss/styles.scss @@ -4,6 +4,7 @@ @import "../../../../libs/angular/src/scss/icons.scss"; @import "../../../../libs/components/src/multi-select/scss/bw.theme"; @import "@angular/cdk/overlay-prebuilt.css"; +@import "@angular/cdk/text-field-prebuilt.css"; //@import "~bootstrap/scss/bootstrap"; @import "~bootstrap/scss/_functions"; diff --git a/libs/components/src/tw-theme.css b/libs/components/src/tw-theme.css index 3bc7cd3d81f..24f0b7adaad 100644 --- a/libs/components/src/tw-theme.css +++ b/libs/components/src/tw-theme.css @@ -1,4 +1,5 @@ @import "@angular/cdk/a11y-prebuilt.css"; +@import "@angular/cdk/text-field-prebuilt.css"; @import "./reset.css"; @import "./popover/popover.component.css"; @import "./toast/toast.tokens.css"; diff --git a/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html b/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html index ab31ede57bb..b71851ef6c9 100644 --- a/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html +++ b/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html @@ -5,13 +5,19 @@
{{ field.name }} - +