From 483a197e4dadb9ef932ce18f9d554a6fcb867a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Tom=C3=A9?= <108268980+r-tome@users.noreply.github.com> Date: Fri, 8 Dec 2023 18:07:52 +0000 Subject: [PATCH] [AC-1139] Flexible collections: deprecate Manage/Edit/Delete Assigned Collections custom permissions (#6906) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [AC-1139] Add new layout for MemberDialogComponent when FC feature flag is enabled * [AC-1139] Deprecated Organization canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections * [AC-1139] Checking if FC feature flag is enabled when using canDeleteAssignedCollections or canViewAssignedCollections * [AC-1139] Added missing parameter to customRedirect * [AC-1139] Fixed canEdit permission * [AC-1139] Fixed CanDelete logic * [AC-1139] Changed canAccessVaultTab function to receive configService * Override deprecated values on sync * [AC-1139] Reverted change that introduced ConfigService as a parameter to canAccessVaultTab * [AC-1139] Fixed circular dependency * [AC-1139] Moved overriding of deprecated values to syncService * Revert "[AC-1139] Fixed circular dependency" This reverts commit 64844209765cc5c30f770b680a243b28f8216fda. * Revert "Override deprecated values on sync" This reverts commit f0c25a69960c7f913d082b1d1edbb3af583c6e99. * [AC-1139] Added back the deprecation of methods canEditAssignedCollections, canDeleteAssignedCollections, canViewAssignedCollections * [AC-1139] Reverted change on syncService * [AC-1139] Override deprecated values on sync * [AC-1139] Fix canDelete logic in collection-dialog.component.ts and bulk-delete-dialog.component.ts * [AC-1139] Moved override logic from syncService to organizationService * [AC-1139] Add ability to have titlecase titles on nested-checkbox.component checkboxes; use on member-dialog.component * Revert "[AC-1139] Add ability to have titlecase titles on nested-checkbox.component checkboxes; use on member-dialog.component" This reverts commit 9ede0fc5ac88f7ee505fed116ed3f40eda76fb52. * [AC-1139] Fix bulk delete functionality * [AC-1139] Refactor canEdit and canDelete to use ternary operator * [AC-1139] Fix canDelete condition in VaultComponent --------- Co-authored-by: Thomas Rittson Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> --- .../browser/src/background/main.background.ts | 1 + apps/cli/src/bw.ts | 1 + .../member-dialog.component.html | 257 +++++++++++++----- .../sm-subscribe-standalone.component.ts | 9 +- .../collection-dialog.component.html | 2 +- .../collection-dialog.component.ts | 7 + .../vault-items/vault-items.component.ts | 2 +- .../vault/core/views/collection-admin.view.ts | 14 +- .../bulk-delete-dialog.component.ts | 19 +- .../vault-header/vault-header.component.ts | 2 +- .../vault/individual-vault/vault.component.ts | 6 +- .../vault-header/vault-header.component.ts | 2 +- .../app/vault/org-vault/vault.component.ts | 10 +- .../src/services/jslib-services.module.ts | 1 + .../organization.service.abstraction.ts | 10 +- .../models/domain/organization.ts | 15 + .../organization/organization.service.spec.ts | 6 +- .../organization/organization.service.ts | 28 +- .../src/vault/models/view/collection.view.ts | 15 +- .../src/vault/services/sync/sync.service.ts | 16 +- 20 files changed, 305 insertions(+), 118 deletions(-) diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index 57237fded7..a42f19c228 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -539,6 +539,7 @@ export default class MainBackground { this.folderApiService, this.organizationService, this.sendApiService, + this.configService, logoutCallback, ); this.eventUploadService = new EventUploadService( diff --git a/apps/cli/src/bw.ts b/apps/cli/src/bw.ts index d00a1bd972..8b3ea41e21 100644 --- a/apps/cli/src/bw.ts +++ b/apps/cli/src/bw.ts @@ -443,6 +443,7 @@ export class Main { this.folderApiService, this.organizationService, this.sendApiService, + this.configService, async (expired: boolean) => await this.logout(), ); diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html index 0b3ec78886..b69103bf12 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.html @@ -138,25 +138,128 @@ -

- {{ "permissions" | i18n }} -

-
-
-
- -
- - + +

+ {{ "permissions" | i18n }} +

+
+
+
+ +
+ + +
+
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
-
-
- -
+ + +
+
+
+
-
- - -
-
- - -
-
- - -
-
- - -
-
- - +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
+

diff --git a/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts b/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts index 1f8b70e03f..e2b3107ae7 100644 --- a/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts +++ b/apps/web/src/app/billing/organizations/sm-subscribe-standalone.component.ts @@ -9,6 +9,8 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga import { SecretsManagerSubscribeRequest } from "@bitwarden/common/billing/models/request/sm-subscribe.request"; import { BillingCustomerDiscount } from "@bitwarden/common/billing/models/response/organization-subscription.response"; import { PlanResponse } from "@bitwarden/common/billing/models/response/plan.response"; +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { ConfigServiceAbstraction } from "@bitwarden/common/platform/abstractions/config/config.service.abstraction"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -33,6 +35,7 @@ export class SecretsManagerSubscribeStandaloneComponent { private i18nService: I18nService, private organizationApiService: OrganizationApiServiceAbstraction, private organizationService: InternalOrganizationServiceAbstraction, + private configService: ConfigServiceAbstraction, ) {} submit = async () => { @@ -52,7 +55,11 @@ export class SecretsManagerSubscribeStandaloneComponent { isMember: this.organization.isMember, isProviderUser: this.organization.isProviderUser, }); - await this.organizationService.upsert(organizationData); + const flexibleCollectionsEnabled = await this.configService.getFeatureFlag( + FeatureFlag.FlexibleCollections, + false, + ); + await this.organizationService.upsert(organizationData, flexibleCollectionsEnabled); /* Because subscribing to Secrets Manager automatically provides access to Secrets Manager for the diff --git a/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.html b/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.html index 41e785a6eb..30227222e6 100644 --- a/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.html +++ b/apps/web/src/app/vault/components/collection-dialog/collection-dialog.component.html @@ -109,7 +109,7 @@ {{ "cancel" | i18n }}