From 90330f798fc8ac8221c368f9d9d13a04c58e3ef9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:19:45 -0400 Subject: [PATCH 1/8] [deps] AC: Update mini-css-extract-plugin to v2.9.1 (#10574) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a1ef2eb87bb..1f8887201fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -157,7 +157,7 @@ "jest-mock-extended": "3.0.7", "jest-preset-angular": "14.1.1", "lint-staged": "15.2.8", - "mini-css-extract-plugin": "2.8.1", + "mini-css-extract-plugin": "2.9.1", "node-ipc": "9.2.1", "postcss": "8.4.38", "postcss-loader": "8.1.1", @@ -27721,9 +27721,9 @@ } }, "node_modules/mini-css-extract-plugin": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.8.1.tgz", - "integrity": "sha512-/1HDlyFRxWIZPI1ZpgqlZ8jMw/1Dp/dl3P0L1jtZ+zVcHqwPhGwaJwKL00WVgfnBy6PWCde9W65or7IIETImuA==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.1.tgz", + "integrity": "sha512-+Vyi+GCCOHnrJ2VPS+6aPoXN2k2jgUzDRhTFLjjTBn23qyXJXkjUWQgTL+mXpF5/A8ixLdCc6kWsoeOjKGejKQ==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 9e1921cbdf8..e8ff1f06c2b 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "jest-mock-extended": "3.0.7", "jest-preset-angular": "14.1.1", "lint-staged": "15.2.8", - "mini-css-extract-plugin": "2.8.1", + "mini-css-extract-plugin": "2.9.1", "node-ipc": "9.2.1", "postcss": "8.4.38", "postcss-loader": "8.1.1", From 546115876fd5c7c170b6660159425f1e83045213 Mon Sep 17 00:00:00 2001 From: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:47:16 -0400 Subject: [PATCH 2/8] Move extension refresh redirect util function to libs so other clients can use it (#10979) --- apps/browser/src/popup/app-routing.module.ts | 2 +- .../angular/src/utils/extension-refresh-redirect.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename apps/browser/src/popup/extension-refresh-route-utils.ts => libs/angular/src/utils/extension-refresh-redirect.ts (94%) diff --git a/apps/browser/src/popup/app-routing.module.ts b/apps/browser/src/popup/app-routing.module.ts index 50f1aef6c00..f715d38422d 100644 --- a/apps/browser/src/popup/app-routing.module.ts +++ b/apps/browser/src/popup/app-routing.module.ts @@ -10,6 +10,7 @@ import { } from "@bitwarden/angular/auth/guards"; import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard"; import { generatorSwap } from "@bitwarden/angular/tools/generator/generator-swap"; +import { extensionRefreshRedirect } from "@bitwarden/angular/utils/extension-refresh-redirect"; import { extensionRefreshSwap } from "@bitwarden/angular/utils/extension-refresh-swap"; import { AnonLayoutWrapperComponent, @@ -98,7 +99,6 @@ import { TrashComponent } from "../vault/popup/settings/trash.component"; import { VaultSettingsV2Component } from "../vault/popup/settings/vault-settings-v2.component"; import { VaultSettingsComponent } from "../vault/popup/settings/vault-settings.component"; -import { extensionRefreshRedirect } from "./extension-refresh-route-utils"; import { debounceNavigationGuard } from "./services/debounce-navigation.service"; import { TabsV2Component } from "./tabs-v2.component"; import { TabsComponent } from "./tabs.component"; diff --git a/apps/browser/src/popup/extension-refresh-route-utils.ts b/libs/angular/src/utils/extension-refresh-redirect.ts similarity index 94% rename from apps/browser/src/popup/extension-refresh-route-utils.ts rename to libs/angular/src/utils/extension-refresh-redirect.ts index 9d45d7d656d..f7399d9c278 100644 --- a/apps/browser/src/popup/extension-refresh-route-utils.ts +++ b/libs/angular/src/utils/extension-refresh-redirect.ts @@ -1,5 +1,5 @@ import { inject } from "@angular/core"; -import { Router, UrlTree } from "@angular/router"; +import { UrlTree, Router } from "@angular/router"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; From 35f4b4c7ac3fcfcdca7cea818113595ffa6975f0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:01:37 -0700 Subject: [PATCH 3/8] [deps] Vault: Update https-proxy-agent to v7.0.5 (#7932) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- apps/cli/package.json | 2 +- package-lock.json | 23 +++++------------------ package.json | 2 +- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/apps/cli/package.json b/apps/cli/package.json index a7759043ff6..bf60020b523 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -64,7 +64,7 @@ "chalk": "4.1.2", "commander": "11.1.0", "form-data": "4.0.0", - "https-proxy-agent": "7.0.2", + "https-proxy-agent": "7.0.5", "inquirer": "8.2.6", "jsdom": "24.1.3", "jszip": "3.10.1", diff --git a/package-lock.json b/package-lock.json index 1f8887201fb..7cc733665a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "commander": "11.1.0", "core-js": "3.36.1", "form-data": "4.0.0", - "https-proxy-agent": "7.0.2", + "https-proxy-agent": "7.0.5", "inquirer": "8.2.6", "jquery": "3.7.1", "jsdom": "24.1.3", @@ -207,7 +207,7 @@ "chalk": "4.1.2", "commander": "11.1.0", "form-data": "4.0.0", - "https-proxy-agent": "7.0.2", + "https-proxy-agent": "7.0.5", "inquirer": "8.2.6", "jsdom": "24.1.3", "jszip": "3.10.1", @@ -21637,9 +21637,9 @@ } }, "node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "license": "MIT", "dependencies": { "agent-base": "^7.0.2", @@ -24733,19 +24733,6 @@ "node": ">= 14" } }, - "node_modules/jsdom/node_modules/https-proxy-agent": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", - "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", - "license": "MIT", - "dependencies": { - "agent-base": "^7.0.2", - "debug": "4" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", diff --git a/package.json b/package.json index e8ff1f06c2b..365508e31ef 100644 --- a/package.json +++ b/package.json @@ -173,7 +173,7 @@ "commander": "11.1.0", "core-js": "3.36.1", "form-data": "4.0.0", - "https-proxy-agent": "7.0.2", + "https-proxy-agent": "7.0.5", "inquirer": "8.2.6", "jquery": "3.7.1", "jsdom": "24.1.3", From aa2a2d3ed0663fbf9439a58b3167c3538ccbd1a7 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Wed, 11 Sep 2024 14:04:01 +0200 Subject: [PATCH 4/8] Add initial km CODEOWERSHIP (#10988) --- .github/CODEOWNERS | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9eace676f4f..9665d40b07e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -100,12 +100,19 @@ apps/desktop/src/services/native-message-handler.service.ts @bitwarden/team-auto ## Component Library ## .storybook @bitwarden/team-design-system libs/components @bitwarden/team-design-system -apps/browser/src/platform/popup/layout @bitwarden/team-design-system -apps/web/src/app/layouts @bitwarden/team-design-system +apps/browser/src/platform/popup/layout @bitwarden/team-design-system +apps/web/src/app/layouts @bitwarden/team-design-system ## Desktop native module ## apps/desktop/desktop_native @bitwarden/team-platform-dev +## Key management team files ## +apps/desktop/src/key-management @bitwarden/team-key-management-dev +apps/web/src/key-management @bitwarden/team-key-management-dev +apps/browser/src/key-management @bitwarden/team-key-management-dev +apps/cli/src/key-management @bitwarden/team-key-management-dev +libs/common/src/key-management @bitwarden/team-key-management-dev + ## DevOps team files ## /.github/workflows @bitwarden/dept-devops From 4fa31b8f2b2f34aefd943873a71731355df3d04c Mon Sep 17 00:00:00 2001 From: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:48:22 -0400 Subject: [PATCH 5/8] Use payment-v2.component in change-plan-dialog.component when FF is on (#10976) --- .../change-plan-dialog.component.html | 9 ++- .../change-plan-dialog.component.ts | 70 +++++++++++++++---- .../shared/payment/payment-v2.component.ts | 2 +- 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/apps/web/src/app/billing/organizations/change-plan-dialog.component.html b/apps/web/src/app/billing/organizations/change-plan-dialog.component.html index 1c92cbf6632..c893f3832dc 100644 --- a/apps/web/src/app/billing/organizations/change-plan-dialog.component.html +++ b/apps/web/src/app/billing/organizations/change-plan-dialog.component.html @@ -62,7 +62,7 @@ class="tw-px-2 tw-py-4" [ngClass]="{ 'tw-py-1': !(selectableProduct === selectedPlan), - 'tw-py-0': selectableProduct === selectedPlan, + 'tw-py-0': selectableProduct === selectedPlan }" >

@@ -308,9 +308,14 @@

+ + (); constructor( @@ -171,9 +179,15 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { private messagingService: MessagingService, private formBuilder: FormBuilder, private organizationApiService: OrganizationApiServiceAbstraction, + private configService: ConfigService, + private billingApiService: BillingApiServiceAbstraction, ) {} async ngOnInit(): Promise { + this.deprecateStripeSourcesAPI = await this.configService.getFeatureFlag( + FeatureFlag.AC2476_DeprecateStripeSourcesAPI, + ); + if (this.dialogParams.organizationId) { this.currentPlanName = this.resolvePlanName(this.dialogParams.productTierType); this.sub = @@ -595,7 +609,16 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { } changedCountry() { - if (this.paymentComponent && this.taxComponent) { + if (this.deprecateStripeSourcesAPI && this.paymentV2Component && this.taxComponent) { + this.paymentV2Component.showBankAccount = this.taxComponent.country === "US"; + + if ( + !this.paymentV2Component.showBankAccount && + this.paymentV2Component.selected === PaymentMethodType.BankAccount + ) { + this.paymentV2Component.select(PaymentMethodType.Card); + } + } else if (this.paymentComponent && this.taxComponent) { this.paymentComponent!.hideBank = this.taxComponent?.taxFormGroup?.value.country !== "US"; // Bank Account payments are only available for US customers if ( @@ -616,7 +639,7 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { const doSubmit = async (): Promise => { let orgId: string = null; - orgId = await this.updateOrganization(orgId); + orgId = await this.updateOrganization(); this.toastService.showToast({ variant: "success", title: null, @@ -650,12 +673,15 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { this.dialogRef.close(); }; - private async updateOrganization(orgId: string) { + private async updateOrganization() { const request = new OrganizationUpgradeRequest(); if (this.selectedPlan.productTier !== ProductTierType.Families) { request.additionalSeats = this.organization.seats; } - request.additionalStorageGb = this.organization.maxStorageGb; + if (this.organization.maxStorageGb > this.selectedPlan.PasswordManager.baseStorageGb) { + request.additionalStorageGb = + this.organization.maxStorageGb - this.selectedPlan.PasswordManager.baseStorageGb; + } request.premiumAccessAddon = this.selectedPlan.PasswordManager.hasPremiumAccessOption && this.formGroup.controls.premiumAccessAddon.value; @@ -669,13 +695,33 @@ export class ChangePlanDialogComponent implements OnInit, OnDestroy { this.buildSecretsManagerRequest(request); if (this.upgradeRequiresPaymentMethod || this.showPayment) { - const tokenResult = await this.paymentComponent.createPaymentToken(); - const paymentRequest = new PaymentRequest(); - paymentRequest.paymentToken = tokenResult[0]; - paymentRequest.paymentMethodType = tokenResult[1]; - paymentRequest.country = this.taxComponent.taxFormGroup?.value.country; - paymentRequest.postalCode = this.taxComponent.taxFormGroup?.value.postalCode; - await this.organizationApiService.updatePayment(this.organizationId, paymentRequest); + if (this.deprecateStripeSourcesAPI) { + const tokenizedPaymentSource = await this.paymentV2Component.tokenize(); + const updatePaymentMethodRequest = new UpdatePaymentMethodRequest(); + updatePaymentMethodRequest.paymentSource = tokenizedPaymentSource; + updatePaymentMethodRequest.taxInformation = { + country: this.taxComponent.country, + postalCode: this.taxComponent.postalCode, + taxId: this.taxComponent.taxId, + line1: this.taxComponent.line1, + line2: this.taxComponent.line2, + city: this.taxComponent.city, + state: this.taxComponent.state, + }; + + await this.billingApiService.updateOrganizationPaymentMethod( + this.organizationId, + updatePaymentMethodRequest, + ); + } else { + const tokenResult = await this.paymentComponent.createPaymentToken(); + const paymentRequest = new PaymentRequest(); + paymentRequest.paymentToken = tokenResult[0]; + paymentRequest.paymentMethodType = tokenResult[1]; + paymentRequest.country = this.taxComponent.taxFormGroup?.value.country; + paymentRequest.postalCode = this.taxComponent.taxFormGroup?.value.postalCode; + await this.organizationApiService.updatePayment(this.organizationId, paymentRequest); + } } // Backfill pub/priv key if necessary diff --git a/apps/web/src/app/billing/shared/payment/payment-v2.component.ts b/apps/web/src/app/billing/shared/payment/payment-v2.component.ts index 8d7e8d7a0ce..fa2b53fc7b5 100644 --- a/apps/web/src/app/billing/shared/payment/payment-v2.component.ts +++ b/apps/web/src/app/billing/shared/payment/payment-v2.component.ts @@ -86,7 +86,7 @@ export class PaymentV2Component implements OnInit, OnDestroy { /** Programmatically select the provided payment method. */ select = (paymentMethod: PaymentMethodType) => { - this.formGroup.value.paymentMethod = paymentMethod; + this.formGroup.get("paymentMethod").patchValue(paymentMethod); }; protected submit = async () => { From db9003458b81beaaa6242d387917065ee9f93ef5 Mon Sep 17 00:00:00 2001 From: Nick Krantz <125900171+nick-livefront@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:29:53 -0500 Subject: [PATCH 6/8] [PM-11436] New "+" button (#10907) * replace icon in "new" button on admin-console * replace icon in "new" button on secrets manager * reduce flash of "new item" button by checking the availability of the organization --- .../vault-header/vault-header.component.html | 8 ++++++-- .../secrets-manager/shared/new-menu.component.html | 11 +++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html index f583055687c..72b1284b86a 100644 --- a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html +++ b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html @@ -100,7 +100,10 @@ [placeholder]="'searchCollection' | i18n" > -
+
diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.html index 457eff37fac..2238fa9fc87 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/shared/new-menu.component.html @@ -1,11 +1,6 @@ - From 8e4dab5eba5aecdf587d9043e37b31fd83c57010 Mon Sep 17 00:00:00 2001 From: Shane Melton Date: Wed, 11 Sep 2024 10:45:23 -0700 Subject: [PATCH 7/8] [PM-10996] Remove restrict-provider-access feature flag (#10977) --- .../components/vault/collections.component.ts | 3 - .../vault/app/vault/collections.component.ts | 3 - .../vault-collection-row.component.ts | 6 +- .../vault-items/vault-items.component.html | 1 - .../vault-items/vault-items.component.ts | 9 +-- .../bulk-delete-dialog.component.ts | 21 +------ .../collections.component.html | 2 +- .../individual-vault/collections.component.ts | 5 +- .../vault/individual-vault/vault.component.ts | 2 +- .../vault/individual-vault/view.component.ts | 12 +--- .../app/vault/org-vault/add-edit.component.ts | 11 ++-- .../vault/org-vault/attachments.component.ts | 24 ++------ .../vault/org-vault/collections.component.ts | 13 +--- .../vault-header/vault-header.component.html | 2 +- .../vault-header/vault-header.component.ts | 15 +---- .../app/vault/org-vault/vault.component.html | 1 - .../app/vault/org-vault/vault.component.ts | 60 ++++--------------- .../components/collections.component.ts | 9 +-- .../vault/components/add-edit.component.ts | 15 ++--- .../models/domain/organization.ts | 18 +----- libs/common/src/enums/feature-flag.enum.ts | 2 - .../src/vault/models/view/collection.view.ts | 8 +-- .../assign-collections.component.ts | 17 ++---- 23 files changed, 53 insertions(+), 206 deletions(-) diff --git a/apps/browser/src/vault/popup/components/vault/collections.component.ts b/apps/browser/src/vault/popup/components/vault/collections.component.ts index 1204a436f27..19d448e6033 100644 --- a/apps/browser/src/vault/popup/components/vault/collections.component.ts +++ b/apps/browser/src/vault/popup/components/vault/collections.component.ts @@ -6,7 +6,6 @@ import { first } from "rxjs/operators"; import { CollectionsComponent as BaseCollectionsComponent } from "@bitwarden/angular/admin-console/components/collections.component"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -29,7 +28,6 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On private route: ActivatedRoute, private location: Location, logService: LogService, - configService: ConfigService, accountService: AccountService, toastService: ToastService, ) { @@ -40,7 +38,6 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On cipherService, organizationService, logService, - configService, accountService, toastService, ); diff --git a/apps/desktop/src/vault/app/vault/collections.component.ts b/apps/desktop/src/vault/app/vault/collections.component.ts index 7183e4bd5c7..3885ca00578 100644 --- a/apps/desktop/src/vault/app/vault/collections.component.ts +++ b/apps/desktop/src/vault/app/vault/collections.component.ts @@ -3,7 +3,6 @@ import { Component } from "@angular/core"; import { CollectionsComponent as BaseCollectionsComponent } from "@bitwarden/angular/admin-console/components/collections.component"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -23,7 +22,6 @@ export class CollectionsComponent extends BaseCollectionsComponent { platformUtilsService: PlatformUtilsService, organizationService: OrganizationService, logService: LogService, - configService: ConfigService, accountService: AccountService, toastService: ToastService, ) { @@ -34,7 +32,6 @@ export class CollectionsComponent extends BaseCollectionsComponent { cipherService, organizationService, logService, - configService, accountService, toastService, ); diff --git a/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts b/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts index b5f910cd1a0..09e7484b673 100644 --- a/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts +++ b/apps/web/src/app/vault/components/vault-items/vault-collection-row.component.ts @@ -34,7 +34,6 @@ export class VaultCollectionRowComponent { @Input() organizations: Organization[]; @Input() groups: GroupView[]; @Input() showPermissionsColumn: boolean; - @Input() restrictProviderAccess: boolean; @Output() onEvent = new EventEmitter(); @@ -74,10 +73,7 @@ export class VaultCollectionRowComponent { } get permissionText() { - if ( - this.collection.id == Unassigned && - this.organization?.canEditUnassignedCiphers(this.restrictProviderAccess) - ) { + if (this.collection.id == Unassigned && this.organization?.canEditUnassignedCiphers) { return this.i18nService.t("canEdit"); } if ((this.collection as CollectionAdminView).assigned) { diff --git a/apps/web/src/app/vault/components/vault-items/vault-items.component.html b/apps/web/src/app/vault/components/vault-items/vault-items.component.html index ec7b843afc9..7b427d2f124 100644 --- a/apps/web/src/app/vault/components/vault-items/vault-items.component.html +++ b/apps/web/src/app/vault/components/vault-items/vault-items.component.html @@ -106,7 +106,6 @@ [canDeleteCollection]="canDeleteCollection(item.collection)" [canEditCollection]="canEditCollection(item.collection)" [canViewCollectionInfo]="canViewCollectionInfo(item.collection)" - [restrictProviderAccess]="restrictProviderAccess" [checked]="selection.isSelected(item)" (checkedToggled)="selection.toggle(item)" (onEvent)="event($event)" diff --git a/apps/web/src/app/vault/components/vault-items/vault-items.component.ts b/apps/web/src/app/vault/components/vault-items/vault-items.component.ts index 1e65686a0a4..05f32b22ab8 100644 --- a/apps/web/src/app/vault/components/vault-items/vault-items.component.ts +++ b/apps/web/src/app/vault/components/vault-items/vault-items.component.ts @@ -46,7 +46,6 @@ export class VaultItemsComponent { @Input() viewingOrgVault: boolean; @Input() addAccessStatus: number; @Input() addAccessToggle: boolean; - @Input() restrictProviderAccess: boolean; @Input() vaultBulkManagementActionEnabled = false; @Input() activeCollection: CollectionView | undefined; @@ -213,10 +212,7 @@ export class VaultItemsComponent { } const organization = this.allOrganizations.find((o) => o.id === cipher.organizationId); - return ( - (organization.canEditAllCiphers(this.restrictProviderAccess) && this.viewingOrgVault) || - cipher.edit - ); + return (organization.canEditAllCiphers && this.viewingOrgVault) || cipher.edit; } protected canManageCollection(cipher: CipherView) { @@ -306,8 +302,7 @@ export class VaultItemsComponent { const [orgId] = uniqueCipherOrgIds; const organization = this.allOrganizations.find((o) => o.id === orgId); - const canEditOrManageAllCiphers = - organization?.canEditAllCiphers(this.restrictProviderAccess) && this.viewingOrgVault; + const canEditOrManageAllCiphers = organization?.canEditAllCiphers && this.viewingOrgVault; const collectionNotSelected = this.selection.selected.filter((item) => item.collection).length === 0; diff --git a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts index 617628a0b37..e787a31f6e2 100644 --- a/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts +++ b/apps/web/src/app/vault/individual-vault/bulk-action-dialogs/bulk-delete-dialog/bulk-delete-dialog.component.ts @@ -1,11 +1,8 @@ import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog"; import { Component, Inject } from "@angular/core"; -import { firstValueFrom } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; @@ -54,10 +51,6 @@ export class BulkDeleteDialogComponent { collections: CollectionView[]; unassignedCiphers: string[]; - private restrictProviderAccess$ = this.configService.getFeatureFlag$( - FeatureFlag.RestrictProviderAccess, - ); - constructor( @Inject(DIALOG_DATA) params: BulkDeleteDialogParams, private dialogRef: DialogRef, @@ -66,7 +59,6 @@ export class BulkDeleteDialogComponent { private i18nService: I18nService, private apiService: ApiService, private collectionService: CollectionService, - private configService: ConfigService, ) { this.cipherIds = params.cipherIds ?? []; this.permanent = params.permanent; @@ -82,19 +74,13 @@ export class BulkDeleteDialogComponent { protected submit = async () => { const deletePromises: Promise[] = []; - const restrictProviderAccess = await firstValueFrom(this.restrictProviderAccess$); // Unassigned ciphers under an Owner/Admin OR Custom Users With Edit will call the deleteCiphersAdmin method - if ( - this.unassignedCiphers.length && - this.organization.canEditUnassignedCiphers(restrictProviderAccess) - ) { + if (this.unassignedCiphers.length && this.organization.canEditUnassignedCiphers) { deletePromises.push(this.deleteCiphersAdmin(this.unassignedCiphers)); } if (this.cipherIds.length) { - const restrictProviderAccess = await firstValueFrom(this.restrictProviderAccess$); - - if (!this.organization || !this.organization.canEditAllCiphers(restrictProviderAccess)) { + if (!this.organization || !this.organization.canEditAllCiphers) { deletePromises.push(this.deleteCiphers()); } else { deletePromises.push(this.deleteCiphersAdmin(this.cipherIds)); @@ -126,8 +112,7 @@ export class BulkDeleteDialogComponent { }; private async deleteCiphers(): Promise { - const restrictProviderAccess = await firstValueFrom(this.restrictProviderAccess$); - const asAdmin = this.organization?.canEditAllCiphers(restrictProviderAccess); + const asAdmin = this.organization?.canEditAllCiphers; if (this.permanent) { await this.cipherService.deleteManyWithServer(this.cipherIds, asAdmin); } else { diff --git a/apps/web/src/app/vault/individual-vault/collections.component.html b/apps/web/src/app/vault/individual-vault/collections.component.html index e4029ef8669..028d91ad346 100644 --- a/apps/web/src/app/vault/individual-vault/collections.component.html +++ b/apps/web/src/app/vault/individual-vault/collections.component.html @@ -32,7 +32,7 @@ [(ngModel)]="$any(c).checked" name="Collection[{{ i }}].Checked" appStopProp - [disabled]="!c.canEditItems(this.organization, this.restrictProviderAccess)" + [disabled]="!c.canEditItems(this.organization)" /> {{ c.name }} diff --git a/apps/web/src/app/vault/individual-vault/collections.component.ts b/apps/web/src/app/vault/individual-vault/collections.component.ts index cd52e41e38d..0fc5b88d611 100644 --- a/apps/web/src/app/vault/individual-vault/collections.component.ts +++ b/apps/web/src/app/vault/individual-vault/collections.component.ts @@ -4,7 +4,6 @@ import { Component, Inject, OnDestroy } from "@angular/core"; import { CollectionsComponent as BaseCollectionsComponent } from "@bitwarden/angular/admin-console/components/collections.component"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -25,7 +24,6 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On cipherService: CipherService, organizationSerivce: OrganizationService, logService: LogService, - configService: ConfigService, accountService: AccountService, protected dialogRef: DialogRef, @Inject(DIALOG_DATA) params: CollectionsDialogParams, @@ -38,7 +36,6 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On cipherService, organizationSerivce, logService, - configService, accountService, toastService, ); @@ -55,7 +52,7 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On } check(c: CollectionView, select?: boolean) { - if (!c.canEditItems(this.organization, this.restrictProviderAccess)) { + if (!c.canEditItems(this.organization)) { return; } (c as any).checked = select == null ? !(c as any).checked : select; diff --git a/apps/web/src/app/vault/individual-vault/vault.component.ts b/apps/web/src/app/vault/individual-vault/vault.component.ts index d47a8be2523..dcf62235d1b 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -1161,7 +1161,7 @@ export class VaultComponent implements OnInit, OnDestroy { } const organization = this.allOrganizations.find((o) => o.id === cipher.organizationId); - return organization.canEditAllCiphers(false); + return organization.canEditAllCiphers; } private go(queryParams: any = null) { diff --git a/apps/web/src/app/vault/individual-vault/view.component.ts b/apps/web/src/app/vault/individual-vault/view.component.ts index 2a3865cd1d0..77019b6f32e 100644 --- a/apps/web/src/app/vault/individual-vault/view.component.ts +++ b/apps/web/src/app/vault/individual-vault/view.component.ts @@ -1,13 +1,11 @@ import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog"; import { CommonModule } from "@angular/common"; -import { Component, Inject, OnInit, EventEmitter, OnDestroy } from "@angular/core"; +import { Component, EventEmitter, Inject, OnDestroy, OnInit } from "@angular/core"; import { Router } from "@angular/router"; import { Subject } from "rxjs"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; @@ -50,9 +48,7 @@ export class ViewComponent implements OnInit, OnDestroy { cipher: CipherView; onDeletedCipher = new EventEmitter(); cipherTypeString: string; - cipherEditUrl: string; organization: Organization; - restrictProviderAccess = false; protected destroy$ = new Subject(); @@ -67,7 +63,6 @@ export class ViewComponent implements OnInit, OnDestroy { private toastService: ToastService, private organizationService: OrganizationService, private router: Router, - private configService: ConfigService, ) {} /** @@ -79,9 +74,6 @@ export class ViewComponent implements OnInit, OnDestroy { if (this.cipher.organizationId) { this.organization = await this.organizationService.get(this.cipher.organizationId); } - this.restrictProviderAccess = await this.configService.getFeatureFlag( - FeatureFlag.RestrictProviderAccess, - ); } /** @@ -132,7 +124,7 @@ export class ViewComponent implements OnInit, OnDestroy { * Helper method to delete cipher. */ protected async deleteCipher(): Promise { - const asAdmin = this.organization?.canEditAllCiphers(this.restrictProviderAccess); + const asAdmin = this.organization?.canEditAllCiphers; if (this.cipher.isDeleted) { await this.cipherService.deleteWithServer(this.cipher.id, asAdmin); } else { diff --git a/apps/web/src/app/vault/org-vault/add-edit.component.ts b/apps/web/src/app/vault/org-vault/add-edit.component.ts index 6886da371ec..9129ed9cda5 100644 --- a/apps/web/src/app/vault/org-vault/add-edit.component.ts +++ b/apps/web/src/app/vault/org-vault/add-edit.component.ts @@ -83,7 +83,7 @@ export class AddEditComponent extends BaseAddEditComponent { } protected loadCollections() { - if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { + if (!this.organization.canEditAllCiphers) { return super.loadCollections(); } return Promise.resolve(this.collections); @@ -93,10 +93,7 @@ export class AddEditComponent extends BaseAddEditComponent { // Calling loadCipher first to assess if the cipher is unassigned. If null use apiService getCipherAdmin const firstCipherCheck = await super.loadCipher(); - if ( - !this.organization.canEditAllCiphers(this.restrictProviderAccess) && - firstCipherCheck != null - ) { + if (!this.organization.canEditAllCiphers && firstCipherCheck != null) { return firstCipherCheck; } const response = await this.apiService.getCipherAdmin(this.cipherId); @@ -109,7 +106,7 @@ export class AddEditComponent extends BaseAddEditComponent { } protected encryptCipher(userId: UserId) { - if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { + if (!this.organization.canEditAllCiphers) { return super.encryptCipher(userId); } @@ -117,7 +114,7 @@ export class AddEditComponent extends BaseAddEditComponent { } protected async deleteCipher() { - if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { + if (!this.organization.canEditAllCiphers) { return super.deleteCipher(); } return this.cipher.isDeleted diff --git a/apps/web/src/app/vault/org-vault/attachments.component.ts b/apps/web/src/app/vault/org-vault/attachments.component.ts index f02ac693108..9ebb917aaf5 100644 --- a/apps/web/src/app/vault/org-vault/attachments.component.ts +++ b/apps/web/src/app/vault/org-vault/attachments.component.ts @@ -1,12 +1,9 @@ import { Component, OnInit } from "@angular/core"; -import { firstValueFrom } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; import { FileDownloadService } from "@bitwarden/common/platform/abstractions/file-download/file-download.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -30,8 +27,6 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On viewOnly = false; organization: Organization; - private restrictProviderAccess = false; - constructor( cipherService: CipherService, i18nService: I18nService, @@ -44,7 +39,6 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On dialogService: DialogService, billingAccountProfileStateService: BillingAccountProfileStateService, accountService: AccountService, - private configService: ConfigService, ) { super( cipherService, @@ -63,22 +57,16 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On async ngOnInit() { await super.ngOnInit(); - this.restrictProviderAccess = await firstValueFrom( - this.configService.getFeatureFlag$(FeatureFlag.RestrictProviderAccess), - ); } protected async reupload(attachment: AttachmentView) { - if ( - this.organization.canEditAllCiphers(this.restrictProviderAccess) && - this.showFixOldAttachments(attachment) - ) { + if (this.organization.canEditAllCiphers && this.showFixOldAttachments(attachment)) { await super.reuploadCipherAttachment(attachment, true); } } protected async loadCipher() { - if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { + if (!this.organization.canEditAllCiphers) { return await super.loadCipher(); } const response = await this.apiService.getCipherAdmin(this.cipherId); @@ -90,20 +78,18 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On this.cipherDomain, file, userId, - this.organization.canEditAllCiphers(this.restrictProviderAccess), + this.organization.canEditAllCiphers, ); } protected deleteCipherAttachment(attachmentId: string) { - if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { + if (!this.organization.canEditAllCiphers) { return super.deleteCipherAttachment(attachmentId); } return this.apiService.deleteCipherAttachmentAdmin(this.cipherId, attachmentId); } protected showFixOldAttachments(attachment: AttachmentView) { - return ( - attachment.key == null && this.organization.canEditAllCiphers(this.restrictProviderAccess) - ); + return attachment.key == null && this.organization.canEditAllCiphers; } } diff --git a/apps/web/src/app/vault/org-vault/collections.component.ts b/apps/web/src/app/vault/org-vault/collections.component.ts index 72816d53214..877e7dfe161 100644 --- a/apps/web/src/app/vault/org-vault/collections.component.ts +++ b/apps/web/src/app/vault/org-vault/collections.component.ts @@ -5,7 +5,6 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -37,7 +36,6 @@ export class CollectionsComponent extends BaseCollectionsComponent { organizationService: OrganizationService, private apiService: ApiService, logService: LogService, - configService: ConfigService, accountService: AccountService, protected dialogRef: DialogRef, @Inject(DIALOG_DATA) params: OrgVaultCollectionsDialogParams, @@ -50,7 +48,6 @@ export class CollectionsComponent extends BaseCollectionsComponent { cipherService, organizationService, logService, - configService, accountService, dialogRef, params, @@ -65,10 +62,7 @@ export class CollectionsComponent extends BaseCollectionsComponent { protected async loadCipher() { // if cipher is unassigned use apiService. We can see this by looking at this.collectionIds - if ( - !this.organization.canEditAllCiphers(this.restrictProviderAccess) && - this.collectionIds.length !== 0 - ) { + if (!this.organization.canEditAllCiphers && this.collectionIds.length !== 0) { return await super.loadCipher(); } const response = await this.apiService.getCipherAdmin(this.cipherId); @@ -90,10 +84,7 @@ export class CollectionsComponent extends BaseCollectionsComponent { } protected saveCollections() { - if ( - this.organization.canEditAllCiphers(this.restrictProviderAccess) || - this.collectionIds.length === 0 - ) { + if (this.organization.canEditAllCiphers || this.collectionIds.length === 0) { const request = new CipherCollectionsRequest(this.cipherDomain.collectionIds); return this.apiService.putCipherCollectionsAdmin(this.cipherId, request); } else { diff --git a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html index 72b1284b86a..9189e646d28 100644 --- a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html +++ b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.html @@ -93,7 +93,7 @@ diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index f9652fe08ca..add1ecbe3e5 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -43,9 +43,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { EventType } from "@bitwarden/common/enums"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; @@ -172,17 +170,8 @@ export class VaultComponent implements OnInit, OnDestroy { protected orgRevokedUsers: OrganizationUserUserDetailsResponse[]; - private _restrictProviderAccessFlagEnabled: boolean; - protected get restrictProviderAccessEnabled(): boolean { - return this._restrictProviderAccessFlagEnabled; - } - protected get hideVaultFilters(): boolean { - return ( - this.restrictProviderAccessEnabled && - this.organization?.isProviderUser && - !this.organization?.isMember - ); + return this.organization?.isProviderUser && !this.organization?.isMember; } private searchText$ = new Subject(); @@ -218,7 +207,6 @@ export class VaultComponent implements OnInit, OnDestroy { private apiService: ApiService, private collectionService: CollectionService, private organizationUserApiService: OrganizationUserApiService, - protected configService: ConfigService, private toastService: ToastService, private accountService: AccountService, ) {} @@ -230,10 +218,6 @@ export class VaultComponent implements OnInit, OnDestroy { : "trashCleanupWarning", ); - this._restrictProviderAccessFlagEnabled = await this.configService.getFeatureFlag( - FeatureFlag.RestrictProviderAccess, - ); - const filter$ = this.routedVaultFilterService.filter$; const organizationId$ = filter$.pipe( map((filter) => filter.organizationId), @@ -325,7 +309,7 @@ export class VaultComponent implements OnInit, OnDestroy { this.editableCollections$ = this.allCollectionsWithoutUnassigned$.pipe( map((collections) => { // Users that can edit all ciphers can implicitly add to / edit within any collection - if (this.organization.canEditAllCiphers(this.restrictProviderAccessEnabled)) { + if (this.organization.canEditAllCiphers) { return collections; } // The user is only allowed to add/edit items to assigned collections that are not readonly @@ -362,16 +346,12 @@ export class VaultComponent implements OnInit, OnDestroy { // Restricted providers (who are not members) do not have access org cipher endpoint below // Return early to avoid 404 response - if ( - this.restrictProviderAccessEnabled && - !organization.isMember && - organization.isProviderUser - ) { + if (!organization.isMember && organization.isProviderUser) { return []; } // If the user can edit all ciphers for the organization then fetch them ALL. - if (organization.canEditAllCiphers(this.restrictProviderAccessEnabled)) { + if (organization.canEditAllCiphers) { ciphers = await this.cipherService.getAllFromApiForOrganization(organization.id); } else { // Otherwise, only fetch ciphers they have access to (includes unassigned for admins). @@ -476,11 +456,8 @@ export class VaultComponent implements OnInit, OnDestroy { ]).pipe( map(([filter, collection, organization]) => { return ( - (filter.collectionId === Unassigned && - !organization.canEditUnassignedCiphers(this.restrictProviderAccessEnabled)) || - (!organization.canEditAllCiphers(this.restrictProviderAccessEnabled) && - collection != undefined && - !collection.node.assigned) + (filter.collectionId === Unassigned && !organization.canEditUnassignedCiphers) || + (!organization.canEditAllCiphers && collection != undefined && !collection.node.assigned) ); }), shareReplay({ refCount: true, bufferSize: 1 }), @@ -525,7 +502,7 @@ export class VaultComponent implements OnInit, OnDestroy { } const canEditCipher = - organization.canEditAllCiphers(this.restrictProviderAccessEnabled) || + organization.canEditAllCiphers || (await firstValueFrom(allCipherMap$))[cipherId] != undefined; if (canEditCipher) { @@ -758,15 +735,9 @@ export class VaultComponent implements OnInit, OnDestroy { this.allCollectionsWithoutUnassigned$.pipe( map((c) => { return c.sort((a, b) => { - if ( - a.canEditItems(this.organization, this.restrictProviderAccessEnabled) && - !b.canEditItems(this.organization, this.restrictProviderAccessEnabled) - ) { + if (a.canEditItems(this.organization) && !b.canEditItems(this.organization)) { return -1; - } else if ( - !a.canEditItems(this.organization, this.restrictProviderAccessEnabled) && - b.canEditItems(this.organization, this.restrictProviderAccessEnabled) - ) { + } else if (!a.canEditItems(this.organization) && b.canEditItems(this.organization)) { return 1; } else { return a.name.localeCompare(b.name); @@ -1001,9 +972,7 @@ export class VaultComponent implements OnInit, OnDestroy { const unassignedCiphers: string[] = []; // If user has edit all Access no need to check for unassigned ciphers - const canEditAll = this.organization.canEditAllCiphers(this.restrictProviderAccessEnabled); - - if (canEditAll) { + if (this.organization.canEditAllCiphers) { ciphers.map((cipher) => { editAccessCiphers.push(cipher.id); }); @@ -1042,7 +1011,7 @@ export class VaultComponent implements OnInit, OnDestroy { } async deleteCipher(c: CipherView): Promise { - if (!c.edit && !this.organization.canEditAllCiphers(this.restrictProviderAccessEnabled)) { + if (!c.edit && !this.organization.canEditAllCiphers) { this.showMissingPermissionsError(); return; } @@ -1146,9 +1115,7 @@ export class VaultComponent implements OnInit, OnDestroy { const canDeleteCollections = collections == null || collections.every((c) => c.canDelete(organization)); const canDeleteCiphers = - ciphers == null || - ciphers.every((c) => c.edit) || - this.organization.canEditAllCiphers(this.restrictProviderAccessEnabled); + ciphers == null || ciphers.every((c) => c.edit) || this.organization.canEditAllCiphers; if (!canDeleteCiphers || !canDeleteCollections) { this.showMissingPermissionsError(); @@ -1351,8 +1318,7 @@ export class VaultComponent implements OnInit, OnDestroy { } protected deleteCipherWithServer(id: string, permanent: boolean, isUnassigned: boolean) { - const asAdmin = - this.organization?.canEditAllCiphers(this.restrictProviderAccessEnabled) || isUnassigned; + const asAdmin = this.organization?.canEditAllCiphers || isUnassigned; return permanent ? this.cipherService.deleteWithServer(id, asAdmin) : this.cipherService.softDeleteWithServer(id, asAdmin); diff --git a/libs/angular/src/admin-console/components/collections.component.ts b/libs/angular/src/admin-console/components/collections.component.ts index 4f166286184..d6801aa155e 100644 --- a/libs/angular/src/admin-console/components/collections.component.ts +++ b/libs/angular/src/admin-console/components/collections.component.ts @@ -4,8 +4,6 @@ import { firstValueFrom, map } from "rxjs"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -27,7 +25,6 @@ export class CollectionsComponent implements OnInit { collectionIds: string[]; collections: CollectionView[] = []; organization: Organization; - restrictProviderAccess: boolean; protected cipherDomain: Cipher; @@ -38,15 +35,11 @@ export class CollectionsComponent implements OnInit { protected cipherService: CipherService, protected organizationService: OrganizationService, private logService: LogService, - private configService: ConfigService, private accountService: AccountService, private toastService: ToastService, ) {} async ngOnInit() { - this.restrictProviderAccess = await this.configService.getFeatureFlag( - FeatureFlag.RestrictProviderAccess, - ); await this.load(); } @@ -76,7 +69,7 @@ export class CollectionsComponent implements OnInit { async submit(): Promise { const selectedCollectionIds = this.collections .filter((c) => { - if (this.organization.canEditAllCiphers(this.restrictProviderAccess)) { + if (this.organization.canEditAllCiphers) { return !!(c as any).checked; } else { return !!(c as any).checked && c.readOnly == null; diff --git a/libs/angular/src/vault/components/add-edit.component.ts b/libs/angular/src/vault/components/add-edit.component.ts index 96589fd2b07..45475440d0a 100644 --- a/libs/angular/src/vault/components/add-edit.component.ts +++ b/libs/angular/src/vault/components/add-edit.component.ts @@ -13,7 +13,6 @@ import { OrganizationUserStatusType, PolicyType } from "@bitwarden/common/admin- import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { EventType } from "@bitwarden/common/enums"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { UriMatchStrategy } from "@bitwarden/common/models/domain/domain-service"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -92,8 +91,6 @@ export class AddEditComponent implements OnInit, OnDestroy { private personalOwnershipPolicyAppliesToActiveUser: boolean; private previousCipherId: string; - protected restrictProviderAccess = false; - get fido2CredentialCreationDateValue(): string { const dateCreated = this.i18nService.t("dateCreated"); const creationDate = this.datePipe.transform( @@ -182,10 +179,6 @@ export class AddEditComponent implements OnInit, OnDestroy { } async ngOnInit() { - this.restrictProviderAccess = await this.configService.getFeatureFlag( - FeatureFlag.RestrictProviderAccess, - ); - this.policyService .policyAppliesToActiveUser$(PolicyType.PersonalOwnership) .pipe( @@ -683,11 +676,11 @@ export class AddEditComponent implements OnInit, OnDestroy { protected saveCipher(cipher: Cipher) { const isNotClone = this.editMode && !this.cloneMode; - let orgAdmin = this.organization?.canEditAllCiphers(this.restrictProviderAccess); + let orgAdmin = this.organization?.canEditAllCiphers; // if a cipher is unassigned we want to check if they are an admin or have permission to edit any collection if (!cipher.collectionIds) { - orgAdmin = this.organization?.canEditUnassignedCiphers(this.restrictProviderAccess); + orgAdmin = this.organization?.canEditUnassignedCiphers; } return this.cipher.id == null @@ -696,14 +689,14 @@ export class AddEditComponent implements OnInit, OnDestroy { } protected deleteCipher() { - const asAdmin = this.organization?.canEditAllCiphers(this.restrictProviderAccess); + const asAdmin = this.organization?.canEditAllCiphers; return this.cipher.isDeleted ? this.cipherService.deleteWithServer(this.cipher.id, asAdmin) : this.cipherService.softDeleteWithServer(this.cipher.id, asAdmin); } protected restoreCipher() { - const asAdmin = this.organization?.canEditAllCiphers(this.restrictProviderAccess); + const asAdmin = this.organization?.canEditAllCiphers; return this.cipherService.restoreWithServer(this.cipher.id, asAdmin); } diff --git a/libs/common/src/admin-console/models/domain/organization.ts b/libs/common/src/admin-console/models/domain/organization.ts index 490c799ad18..8c28bcb4935 100644 --- a/libs/common/src/admin-console/models/domain/organization.ts +++ b/libs/common/src/admin-console/models/domain/organization.ts @@ -183,14 +183,7 @@ export class Organization { return this.isAdmin || this.permissions.editAnyCollection; } - canEditUnassignedCiphers(restrictProviderAccessFlagEnabled: boolean) { - // Providers can access items until the restrictProviderAccess flag is enabled - // After the flag is enabled and removed, this block will be deleted - // so that they permanently lose access to items - if (this.isProviderUser && !restrictProviderAccessFlagEnabled) { - return true; - } - + get canEditUnassignedCiphers() { return ( this.type === OrganizationUserType.Admin || this.type === OrganizationUserType.Owner || @@ -198,14 +191,7 @@ export class Organization { ); } - canEditAllCiphers(restrictProviderAccessFlagEnabled: boolean) { - // Providers can access items until the restrictProviderAccess flag is enabled - // After the flag is enabled and removed, this block will be deleted - // so that they permanently lose access to items - if (this.isProviderUser && !restrictProviderAccessFlagEnabled) { - return true; - } - + get canEditAllCiphers() { // The allowAdminAccessToAllCollectionItems flag can restrict admins // Custom users with canEditAnyCollection are not affected by allowAdminAccessToAllCollectionItems flag return ( diff --git a/libs/common/src/enums/feature-flag.enum.ts b/libs/common/src/enums/feature-flag.enum.ts index 53baea14c5c..e7ece5b36a7 100644 --- a/libs/common/src/enums/feature-flag.enum.ts +++ b/libs/common/src/enums/feature-flag.enum.ts @@ -12,7 +12,6 @@ export enum FeatureFlag { EnableDeleteProvider = "AC-1218-delete-provider", ExtensionRefresh = "extension-refresh", PersistPopupView = "persist-popup-view", - RestrictProviderAccess = "restrict-provider-access", PM4154_BulkEncryptionService = "PM-4154-bulk-encryption-service", UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection", EmailVerification = "email-verification", @@ -59,7 +58,6 @@ export const DefaultFeatureFlagValue = { [FeatureFlag.EnableDeleteProvider]: FALSE, [FeatureFlag.ExtensionRefresh]: FALSE, [FeatureFlag.PersistPopupView]: FALSE, - [FeatureFlag.RestrictProviderAccess]: FALSE, [FeatureFlag.PM4154_BulkEncryptionService]: FALSE, [FeatureFlag.UseTreeWalkerApiForPageDetailsCollection]: FALSE, [FeatureFlag.EmailVerification]: FALSE, diff --git a/libs/common/src/vault/models/view/collection.view.ts b/libs/common/src/vault/models/view/collection.view.ts index 0a05007b66f..873f538ca64 100644 --- a/libs/common/src/vault/models/view/collection.view.ts +++ b/libs/common/src/vault/models/view/collection.view.ts @@ -38,18 +38,14 @@ export class CollectionView implements View, ITreeNodeObject { } } - canEditItems(org: Organization, restrictProviderAccess: boolean): boolean { + canEditItems(org: Organization): boolean { if (org != null && org.id !== this.organizationId) { throw new Error( "Id of the organization provided does not match the org id of the collection.", ); } - return ( - org?.canEditAllCiphers(restrictProviderAccess) || - this.manage || - (this.assigned && !this.readOnly) - ); + return org?.canEditAllCiphers || this.manage || (this.assigned && !this.readOnly); } /** diff --git a/libs/vault/src/components/assign-collections.component.ts b/libs/vault/src/components/assign-collections.component.ts index 188fc543eff..db4d61691c9 100644 --- a/libs/vault/src/components/assign-collections.component.ts +++ b/libs/vault/src/components/assign-collections.component.ts @@ -11,12 +11,12 @@ import { } from "@angular/core"; import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms"; import { - Observable, - Subject, combineLatest, firstValueFrom, map, + Observable, shareReplay, + Subject, switchMap, takeUntil, tap, @@ -27,8 +27,6 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { OrganizationUserStatusType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { CipherId, CollectionId, OrganizationId, UserId } from "@bitwarden/common/types/guid"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; @@ -170,7 +168,6 @@ export class AssignCollectionsComponent implements OnInit, OnDestroy, AfterViewI constructor( private cipherService: CipherService, private i18nService: I18nService, - private configService: ConfigService, private organizationService: OrganizationService, private collectionService: CollectionService, private formBuilder: FormBuilder, @@ -179,10 +176,6 @@ export class AssignCollectionsComponent implements OnInit, OnDestroy, AfterViewI ) {} async ngOnInit() { - const restrictProviderAccess = await this.configService.getFeatureFlag( - FeatureFlag.RestrictProviderAccess, - ); - this.activeUserId = await firstValueFrom( this.accountService.activeAccount$.pipe(map((a) => a?.id)), ); @@ -193,7 +186,7 @@ export class AssignCollectionsComponent implements OnInit, OnDestroy, AfterViewI this.showOrgSelector = true; } - await this.initializeItems(this.selectedOrgId, restrictProviderAccess); + await this.initializeItems(this.selectedOrgId); if (this.selectedOrgId && this.selectedOrgId !== MY_VAULT_ID) { await this.handleOrganizationCiphers(); @@ -339,7 +332,7 @@ export class AssignCollectionsComponent implements OnInit, OnDestroy, AfterViewI } } - private async initializeItems(organizationId: OrganizationId, restrictProviderAccess: boolean) { + private async initializeItems(organizationId: OrganizationId) { this.totalItemCount = this.params.ciphers.length; // If organizationId is not present or organizationId is MyVault, then all ciphers are considered personal items @@ -354,7 +347,7 @@ export class AssignCollectionsComponent implements OnInit, OnDestroy, AfterViewI const org = await this.organizationService.get(organizationId); this.orgName = org.name; - this.editableItems = org.canEditAllCiphers(restrictProviderAccess) + this.editableItems = org.canEditAllCiphers ? this.params.ciphers : this.params.ciphers.filter((c) => c.edit); From a0a0a7ae1368262850d6fbe14a860077ffe4afd1 Mon Sep 17 00:00:00 2001 From: Victoria League Date: Wed, 11 Sep 2024 14:54:07 -0400 Subject: [PATCH 8/8] [CL-395] Add and use art colors in svgs (#10990) --- .../vault-ui-onboarding.component.ts | 14 ++++---- libs/auth/src/angular/icons/lock.icon.ts | 22 ++++++------- libs/components/src/icon/icons/no-results.ts | 22 ++++++------- libs/components/src/tw-theme.css | 6 ++++ libs/components/tailwind.config.base.js | 4 +++ .../send/send-ui/src/icons/no-send.icon.ts | 14 ++++---- .../send-ui/src/icons/send-created.icon.ts | 12 +++---- libs/vault/src/icons/deactivated-org.ts | 32 +++++++++---------- libs/vault/src/icons/empty-trash.ts | 20 ++++++------ libs/vault/src/icons/no-folders.ts | 26 +++++++-------- libs/vault/src/icons/vault.ts | 18 +++++------ 11 files changed, 100 insertions(+), 90 deletions(-) diff --git a/apps/browser/src/vault/popup/components/vault-v2/vault-ui-onboarding/vault-ui-onboarding.component.ts b/apps/browser/src/vault/popup/components/vault-v2/vault-ui-onboarding/vault-ui-onboarding.component.ts index 9022a3b0489..20b39c5a88d 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/vault-ui-onboarding/vault-ui-onboarding.component.ts +++ b/apps/browser/src/vault/popup/components/vault-v2/vault-ui-onboarding/vault-ui-onboarding.component.ts @@ -13,13 +13,13 @@ import { const announcementIcon = svgIcon` - - - - - - - + + + + + + + diff --git a/libs/auth/src/angular/icons/lock.icon.ts b/libs/auth/src/angular/icons/lock.icon.ts index 981b520010a..198733d0dca 100644 --- a/libs/auth/src/angular/icons/lock.icon.ts +++ b/libs/auth/src/angular/icons/lock.icon.ts @@ -2,16 +2,16 @@ import { svgIcon } from "@bitwarden/components"; export const LockIcon = svgIcon` - - - - - - - - - - - + + + + + + + + + + + `; diff --git a/libs/components/src/icon/icons/no-results.ts b/libs/components/src/icon/icons/no-results.ts index 02e03f4c4ec..7ed886a06e9 100644 --- a/libs/components/src/icon/icons/no-results.ts +++ b/libs/components/src/icon/icons/no-results.ts @@ -2,17 +2,17 @@ import { svgIcon } from "../icon"; export const NoResults = svgIcon` - - - - - - - - - - - + + + + + + + + + + + `; diff --git a/libs/components/src/tw-theme.css b/libs/components/src/tw-theme.css index 6234ba380bc..6e5bb32edad 100644 --- a/libs/components/src/tw-theme.css +++ b/libs/components/src/tw-theme.css @@ -42,6 +42,9 @@ --color-info-600: 85 85 85; --color-info-700: 59 58 58; + --color-art-primary: 2 15 102; + --color-art-accent: 85 85 85; + --color-text-main: 33 37 41; --color-text-muted: 109 117 126; --color-text-contrast: 255 255 255; @@ -90,6 +93,9 @@ --color-info-600: 164 176 198; --color-info-700: 209 215 226; + --color-art-primary: 226 227 228; + --color-art-accent: 164 176 198; + --color-text-main: 255 255 255; --color-text-muted: 186 192 206; --color-text-contrast: 25 30 38; diff --git a/libs/components/tailwind.config.base.js b/libs/components/tailwind.config.base.js index 236baed74c8..537e731f14f 100644 --- a/libs/components/tailwind.config.base.js +++ b/libs/components/tailwind.config.base.js @@ -54,6 +54,10 @@ module.exports = { 600: rgba("--color-info-600"), 700: rgba("--color-info-700"), }, + art: { + primary: rgba("--color-art-primary"), + accent: rgba("--color-art-accent"), + }, text: { main: rgba("--color-text-main"), muted: rgba("--color-text-muted"), diff --git a/libs/tools/send/send-ui/src/icons/no-send.icon.ts b/libs/tools/send/send-ui/src/icons/no-send.icon.ts index e1442ad7029..555d8024601 100644 --- a/libs/tools/send/send-ui/src/icons/no-send.icon.ts +++ b/libs/tools/send/send-ui/src/icons/no-send.icon.ts @@ -2,12 +2,12 @@ import { svgIcon } from "@bitwarden/components"; export const NoSendsIcon = svgIcon` - - - - - - - + + + + + + + `; diff --git a/libs/tools/send/send-ui/src/icons/send-created.icon.ts b/libs/tools/send/send-ui/src/icons/send-created.icon.ts index bb4bc2dd3b9..099baebb9ad 100644 --- a/libs/tools/send/send-ui/src/icons/send-created.icon.ts +++ b/libs/tools/send/send-ui/src/icons/send-created.icon.ts @@ -2,12 +2,12 @@ import { svgIcon } from "@bitwarden/components"; export const SendCreatedIcon = svgIcon` - - - - - - + + + + + + diff --git a/libs/vault/src/icons/deactivated-org.ts b/libs/vault/src/icons/deactivated-org.ts index 7d1871a091d..5f7c910aec8 100644 --- a/libs/vault/src/icons/deactivated-org.ts +++ b/libs/vault/src/icons/deactivated-org.ts @@ -3,22 +3,22 @@ import { svgIcon } from "@bitwarden/components"; export const DeactivatedOrg = svgIcon` - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/libs/vault/src/icons/empty-trash.ts b/libs/vault/src/icons/empty-trash.ts index e112309e323..df74602e6d1 100644 --- a/libs/vault/src/icons/empty-trash.ts +++ b/libs/vault/src/icons/empty-trash.ts @@ -3,16 +3,16 @@ import { svgIcon } from "@bitwarden/components"; export const EmptyTrash = svgIcon` - - - - - - - - - + + + + + + + + + - + `; diff --git a/libs/vault/src/icons/no-folders.ts b/libs/vault/src/icons/no-folders.ts index 478cb6a6b79..666bfc86c4c 100644 --- a/libs/vault/src/icons/no-folders.ts +++ b/libs/vault/src/icons/no-folders.ts @@ -2,18 +2,18 @@ import { svgIcon } from "@bitwarden/components"; export const NoFolders = svgIcon` - - - - - - - - - - - - - + + + + + + + + + + + + + `; diff --git a/libs/vault/src/icons/vault.ts b/libs/vault/src/icons/vault.ts index 4afe0920f7b..577080b0f37 100644 --- a/libs/vault/src/icons/vault.ts +++ b/libs/vault/src/icons/vault.ts @@ -3,15 +3,15 @@ import { svgIcon } from "@bitwarden/components"; export const Vault = svgIcon` - - - - - - - - - + + + + + + + + + `;