From 471dd3bd7b23ac0ceb745456f27565540cc42188 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Tue, 13 Aug 2024 10:45:41 -0500 Subject: [PATCH] [PM-10294] Remove FC v1 from Clients (#10422) * chore: remove fc v1 from org.canEditAnyCollection and update callers, refs PM-10294 * chore: remove fc v1 from collectionView.canEdit and update callers, refs PM-10294 * chore: remove fc v1 from organization.canEditAllCiphers and update callers, refs PM-10294 * chore: remove fc v1 from canDeleteAnyCollection, collection views, update callers, refs PM-10294 * chore: remove fc v1 from canEditUser/GroupAccess, refs PM-10294 * chore: remove fc v1 from canViewCollectionInfo, refs PM-10294 * chore: remove fc v1 from account component, refs PM-10294 * fix: remove fc v1 from collections component, refs PM-10294 * fix: update vault-items component, refs PM-10294 * fix: remove fc v1 from collection-dialog and collections components, refs PM-10294 * chore: remove ConfigService from group-add-edit and account components, refs PM-10294 * chore: change canEditAnyCollection to getter and update callers, refs PM-10294 * chore: change canEditUnmanagedCollections to getter and update callers, refs PM-10294 * chore: change canDeleteAnyCollection to getter and update callers, refs PM-10294 * chore: remove deprecated observable and update comments with v1, refs PM-10294 * chore: remove ununsed ConfigService from collection-dialog component, refs PM-10294 * chore: remove final fc v1 ref for vault-collection-row, refs PM-10294 --- .../manage/group-add-edit.component.ts | 43 +--- .../member-dialog/member-dialog.component.ts | 101 +++----- .../settings/account.component.html | 2 +- .../settings/account.component.ts | 7 - .../collection-dialog.component.html | 10 +- .../collection-dialog.component.ts | 161 ++++++------ .../vault-collection-row.component.ts | 13 +- .../vault-items/vault-items.component.html | 1 - .../vault-items/vault-items.component.ts | 43 +--- .../vault/core/views/collection-admin.view.ts | 41 +--- .../bulk-delete-dialog.component.ts | 23 +- .../collections.component.html | 8 +- .../individual-vault/collections.component.ts | 8 +- .../vault-header/vault-header.component.ts | 9 +- .../individual-vault/vault.component.html | 1 - .../vault/individual-vault/vault.component.ts | 38 +-- .../app/vault/org-vault/add-edit.component.ts | 26 +- .../vault/org-vault/attachments.component.ts | 34 +-- .../vault/org-vault/collections.component.ts | 10 +- .../vault-header/vault-header.component.ts | 13 +- .../app/vault/org-vault/vault.component.html | 40 +-- .../app/vault/org-vault/vault.component.ts | 231 ++++-------------- .../components/collections.component.ts | 11 +- .../vault/components/add-edit.component.ts | 19 +- .../models/domain/organization.ts | 28 +-- .../src/vault/models/view/collection.view.ts | 39 +-- .../assign-collections.component.ts | 11 +- 27 files changed, 254 insertions(+), 717 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts b/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts index 8df770686f..c12d133f37 100644 --- a/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts +++ b/apps/web/src/app/admin-console/organizations/manage/group-add-edit.component.ts @@ -19,9 +19,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service"; 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 { ErrorResponse } from "@bitwarden/common/models/response/error.response"; -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"; @@ -96,9 +94,6 @@ export class GroupAddEditComponent implements OnInit, OnDestroy { private organization$ = this.organizationService .get$(this.organizationId) .pipe(shareReplay({ refCount: true })); - private flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$( - FeatureFlag.FlexibleCollectionsV1, - ); protected PermissionMode = PermissionMode; protected ResultType = GroupAddEditDialogResultType; @@ -179,27 +174,19 @@ export class GroupAddEditComponent implements OnInit, OnDestroy { shareReplay({ refCount: true, bufferSize: 1 }), ); - protected allowAdminAccessToAllCollectionItems$ = combineLatest([ - this.organization$, - this.flexibleCollectionsV1Enabled$, - ]).pipe( - map(([organization, flexibleCollectionsV1Enabled]) => { - if (!flexibleCollectionsV1Enabled) { - return true; - } - + protected allowAdminAccessToAllCollectionItems$ = this.organization$.pipe( + map((organization) => { return organization.allowAdminAccessToAllCollectionItems; }), ); protected canAssignAccessToAnyCollection$ = combineLatest([ this.organization$, - this.flexibleCollectionsV1Enabled$, this.allowAdminAccessToAllCollectionItems$, ]).pipe( map( - ([org, flexibleCollectionsV1Enabled, allowAdminAccessToAllCollectionItems]) => - org.canEditAnyCollection(flexibleCollectionsV1Enabled) || + ([org, allowAdminAccessToAllCollectionItems]) => + org.canEditAnyCollection || // Manage Groups custom permission cannot edit any collection but they can assign access from this dialog // if permitted by collection management settings (org.permissions.manageGroups && allowAdminAccessToAllCollectionItems), @@ -224,7 +211,6 @@ export class GroupAddEditComponent implements OnInit, OnDestroy { private changeDetectorRef: ChangeDetectorRef, private dialogService: DialogService, private organizationService: OrganizationService, - private configService: ConfigService, private accountService: AccountService, private collectionAdminService: CollectionAdminService, ) { @@ -242,27 +228,13 @@ export class GroupAddEditComponent implements OnInit, OnDestroy { this.cannotAddSelfToGroup$, this.accountService.activeAccount$, this.organization$, - this.flexibleCollectionsV1Enabled$, ]) .pipe(takeUntil(this.destroy$)) .subscribe( - ([ - collections, - members, - group, - restrictGroupAccess, - activeAccount, - organization, - flexibleCollectionsV1Enabled, - ]) => { + ([collections, members, group, restrictGroupAccess, activeAccount, organization]) => { this.members = members; this.group = group; - this.collections = mapToAccessItemViews( - collections, - organization, - flexibleCollectionsV1Enabled, - group, - ); + this.collections = mapToAccessItemViews(collections, organization, group); if (this.group != undefined) { // Must detect changes so that AccessSelector @Inputs() are aware of the latest @@ -384,7 +356,6 @@ function mapToAccessSelections(group: GroupView, items: AccessItemView[]): Acces function mapToAccessItemViews( collections: CollectionAdminView[], organization: Organization, - flexibleCollectionsV1Enabled: boolean, group?: GroupView, ): AccessItemView[] { return ( @@ -396,7 +367,7 @@ function mapToAccessItemViews( type: AccessItemType.Collection, labelName: c.name, listName: c.name, - readonly: !c.canEditGroupAccess(organization, flexibleCollectionsV1Enabled), + readonly: !c.canEditGroupAccess(organization), readonlyPermission: accessSelection ? convertToPermission(accessSelection) : undefined, }; }) diff --git a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts index 81830d1213..ef36f2b80b 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts @@ -23,8 +23,6 @@ import { PermissionsApi } from "@bitwarden/common/admin-console/models/api/permi import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { ProductTierType } from "@bitwarden/common/billing/enums"; -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 { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; @@ -143,7 +141,6 @@ export class MemberDialogComponent implements OnDestroy { private userService: UserAdminService, private organizationUserService: OrganizationUserService, private dialogService: DialogService, - private configService: ConfigService, private accountService: AccountService, organizationService: OrganizationService, ) { @@ -174,15 +171,8 @@ export class MemberDialogComponent implements OnDestroy { ? this.userService.get(this.params.organizationId, this.params.organizationUserId) : of(null); - this.allowAdminAccessToAllCollectionItems$ = combineLatest([ - this.organization$, - this.configService.getFeatureFlag$(FeatureFlag.FlexibleCollectionsV1), - ]).pipe( - map(([organization, flexibleCollectionsV1Enabled]) => { - if (!flexibleCollectionsV1Enabled) { - return true; - } - + this.allowAdminAccessToAllCollectionItems$ = this.organization$.pipe( + map((organization) => { return organization.allowAdminAccessToAllCollectionItems; }), ); @@ -208,18 +198,13 @@ export class MemberDialogComponent implements OnDestroy { } }); - const flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$( - FeatureFlag.FlexibleCollectionsV1, - ); - this.canAssignAccessToAnyCollection$ = combineLatest([ this.organization$, - flexibleCollectionsV1Enabled$, this.allowAdminAccessToAllCollectionItems$, ]).pipe( map( - ([org, flexibleCollectionsV1Enabled, allowAdminAccessToAllCollectionItems]) => - org.canEditAnyCollection(flexibleCollectionsV1Enabled) || + ([org, allowAdminAccessToAllCollectionItems]) => + org.canEditAnyCollection || // Manage Users custom permission cannot edit any collection but they can assign access from this dialog // if permitted by collection management settings (org.permissions.manageUsers && allowAdminAccessToAllCollectionItems), @@ -231,49 +216,39 @@ export class MemberDialogComponent implements OnDestroy { collections: this.collectionAdminService.getAll(this.params.organizationId), userDetails: userDetails$, groups: groups$, - flexibleCollectionsV1Enabled: flexibleCollectionsV1Enabled$, }) .pipe(takeUntil(this.destroy$)) - .subscribe( - ({ organization, collections, userDetails, groups, flexibleCollectionsV1Enabled }) => { - this.setFormValidators(organization); + .subscribe(({ organization, collections, userDetails, groups }) => { + this.setFormValidators(organization); - // Groups tab: populate available groups - this.groupAccessItems = [].concat( - groups.map((g) => mapGroupToAccessItemView(g)), + // Groups tab: populate available groups + this.groupAccessItems = [].concat( + groups.map((g) => mapGroupToAccessItemView(g)), + ); + + // Collections tab: Populate all available collections (including current user access where applicable) + this.collectionAccessItems = collections + .map((c) => + mapCollectionToAccessItemView( + c, + organization, + userDetails == null + ? undefined + : c.users.find((access) => access.id === userDetails.id), + ), + ) + // But remove collections that we can't assign access to, unless the user is already assigned + .filter( + (item) => + !item.readonly || userDetails?.collections.some((access) => access.id == item.id), ); - // Collections tab: Populate all available collections (including current user access where applicable) - this.collectionAccessItems = collections - .map((c) => - mapCollectionToAccessItemView( - c, - organization, - flexibleCollectionsV1Enabled, - userDetails == null - ? undefined - : c.users.find((access) => access.id === userDetails.id), - ), - ) - // But remove collections that we can't assign access to, unless the user is already assigned - .filter( - (item) => - !item.readonly || userDetails?.collections.some((access) => access.id == item.id), - ); + if (userDetails != null) { + this.loadOrganizationUser(userDetails, groups, collections, organization); + } - if (userDetails != null) { - this.loadOrganizationUser( - userDetails, - groups, - collections, - organization, - flexibleCollectionsV1Enabled, - ); - } - - this.loading = false; - }, - ); + this.loading = false; + }); } private setFormValidators(organization: Organization) { @@ -297,7 +272,6 @@ export class MemberDialogComponent implements OnDestroy { groups: GroupView[], collections: CollectionAdminView[], organization: Organization, - flexibleCollectionsV1Enabled: boolean, ) { if (!userDetails) { throw new Error("Could not find user to edit."); @@ -341,13 +315,7 @@ export class MemberDialogComponent implements OnDestroy { // Populate additional collection access via groups (rendered as separate rows from user access) this.collectionAccessItems = this.collectionAccessItems.concat( collectionsFromGroups.map(({ collection, accessSelection, group }) => - mapCollectionToAccessItemView( - collection, - organization, - flexibleCollectionsV1Enabled, - accessSelection, - group, - ), + mapCollectionToAccessItemView(collection, organization, accessSelection, group), ), ); @@ -621,7 +589,6 @@ export class MemberDialogComponent implements OnDestroy { function mapCollectionToAccessItemView( collection: CollectionAdminView, organization: Organization, - flexibleCollectionsV1Enabled: boolean, accessSelection?: CollectionAccessSelectionView, group?: GroupView, ): AccessItemView { @@ -630,9 +597,7 @@ function mapCollectionToAccessItemView( id: group ? `${collection.id}-${group.id}` : collection.id, labelName: collection.name, listName: collection.name, - readonly: - group !== undefined || - !collection.canEditUserAccess(organization, flexibleCollectionsV1Enabled), + readonly: group !== undefined || !collection.canEditUserAccess(organization), readonlyPermission: accessSelection ? convertToPermission(accessSelection) : undefined, viaGroupName: group?.name, }; diff --git a/apps/web/src/app/admin-console/organizations/settings/account.component.html b/apps/web/src/app/admin-console/organizations/settings/account.component.html index f453546fca..af605dfd27 100644 --- a/apps/web/src/app/admin-console/organizations/settings/account.component.html +++ b/apps/web/src/app/admin-console/organizations/settings/account.component.html @@ -56,7 +56,7 @@ >

{{ "collectionManagement" | i18n }}

{{ "collectionManagementDesc" | i18n }}

- + {{ "allowAdminAccessToAllCollectionItemsDesc" | i18n }} diff --git a/apps/web/src/app/admin-console/organizations/settings/account.component.ts b/apps/web/src/app/admin-console/organizations/settings/account.component.ts index c53a4991d5..7cfbee166e 100644 --- a/apps/web/src/app/admin-console/organizations/settings/account.component.ts +++ b/apps/web/src/app/admin-console/organizations/settings/account.component.ts @@ -10,8 +10,6 @@ import { OrganizationCollectionManagementUpdateRequest } from "@bitwarden/common import { OrganizationKeysRequest } from "@bitwarden/common/admin-console/models/request/organization-keys.request"; import { OrganizationUpdateRequest } from "@bitwarden/common/admin-console/models/request/organization-update.request"; import { OrganizationResponse } from "@bitwarden/common/admin-console/models/response/organization.response"; -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 { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -40,10 +38,6 @@ export class AccountComponent implements OnInit, OnDestroy { org: OrganizationResponse; taxFormPromise: Promise; - flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$( - FeatureFlag.FlexibleCollectionsV1, - ); - // FormGroup validators taken from server Organization domain object protected formGroup = this.formBuilder.group({ orgName: this.formBuilder.control( @@ -83,7 +77,6 @@ export class AccountComponent implements OnInit, OnDestroy { private organizationApiService: OrganizationApiServiceAbstraction, private dialogService: DialogService, private formBuilder: FormBuilder, - private configService: ConfigService, ) {} async ngOnInit() { 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 0640681cf4..fbe0649c7a 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 @@ -80,13 +80,9 @@ {{ "grantCollectionAccessMembersOnly" | i18n }} - {{ " " + ("adminCollectionAccess" | i18n) }} + + {{ " " + ("adminCollectionAccess" | i18n) }} +
(); protected organizations$: Observable; @@ -113,7 +107,6 @@ export class CollectionDialogComponent implements OnInit, OnDestroy { private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private organizationUserService: OrganizationUserService, - private configService: ConfigService, private dialogService: DialogService, private changeDetectorRef: ChangeDetectorRef, ) { @@ -163,95 +156,90 @@ export class CollectionDialogComponent implements OnInit, OnDestroy { groups: groups$, // Collection(s) needed to map readonlypermission for (potential) access selector disabled state users: this.organizationUserService.getAllUsers(orgId, { includeCollections: true }), - flexibleCollectionsV1: this.flexibleCollectionsV1Enabled$, }) .pipe(takeUntil(this.formGroup.controls.selectedOrg.valueChanges), takeUntil(this.destroy$)) - .subscribe( - ({ organization, collections: allCollections, groups, users, flexibleCollectionsV1 }) => { - this.organization = organization; - this.accessItems = [].concat( - groups.map((group) => mapGroupToAccessItemView(group, this.collectionId)), - users.data.map((user) => mapUserToAccessItemView(user, this.collectionId)), - ); + .subscribe(({ organization, collections: allCollections, groups, users }) => { + this.organization = organization; + this.accessItems = [].concat( + groups.map((group) => mapGroupToAccessItemView(group, this.collectionId)), + users.data.map((user) => mapUserToAccessItemView(user, this.collectionId)), + ); - // Force change detection to update the access selector's items - this.changeDetectorRef.detectChanges(); + // Force change detection to update the access selector's items + this.changeDetectorRef.detectChanges(); - this.nestOptions = this.params.limitNestedCollections - ? allCollections.filter((c) => c.manage) - : allCollections; + this.nestOptions = this.params.limitNestedCollections + ? allCollections.filter((c) => c.manage) + : allCollections; - if (this.params.collectionId) { - this.collection = allCollections.find((c) => c.id === this.collectionId); - // Ensure we don't allow nesting the current collection within itself - this.nestOptions = this.nestOptions.filter((c) => c.id !== this.collectionId); + if (this.params.collectionId) { + this.collection = allCollections.find((c) => c.id === this.collectionId); + // Ensure we don't allow nesting the current collection within itself + this.nestOptions = this.nestOptions.filter((c) => c.id !== this.collectionId); - if (!this.collection) { - throw new Error("Could not find collection to edit."); - } - - // Parse the name to find its parent name - const { name, parent: parentName } = parseName(this.collection); - - // Determine if the user can see/select the parent collection - if (parentName !== undefined) { - if ( - this.organization.canViewAllCollections && - !allCollections.find((c) => c.name === parentName) - ) { - // The user can view all collections, but the parent was not found -> assume it has been deleted - this.deletedParentName = parentName; - } else if (!this.nestOptions.find((c) => c.name === parentName)) { - // We cannot find the current parent collection in our list of options, so add a placeholder - this.nestOptions.unshift({ name: parentName } as CollectionView); - } - } - - const accessSelections = mapToAccessSelections(this.collection); - this.formGroup.patchValue({ - name, - externalId: this.collection.externalId, - parent: parentName, - access: accessSelections, - }); - this.showDeleteButton = - !this.dialogReadonly && - this.collection.canDelete(organization, flexibleCollectionsV1); - } else { - const parent = this.nestOptions.find((c) => c.id === this.params.parentCollectionId); - const currentOrgUserId = users.data.find( - (u) => u.userId === this.organization?.userId, - )?.id; - const initialSelection: AccessItemValue[] = - currentOrgUserId !== undefined - ? [ - { - id: currentOrgUserId, - type: AccessItemType.Member, - permission: CollectionPermission.Manage, - }, - ] - : []; - - this.formGroup.patchValue({ - parent: parent?.name ?? undefined, - access: initialSelection, - }); + if (!this.collection) { + throw new Error("Could not find collection to edit."); } - if (flexibleCollectionsV1 && !organization.allowAdminAccessToAllCollectionItems) { - this.formGroup.controls.access.addValidators(validateCanManagePermission); - } else { - this.formGroup.controls.access.removeValidators(validateCanManagePermission); + // Parse the name to find its parent name + const { name, parent: parentName } = parseName(this.collection); + + // Determine if the user can see/select the parent collection + if (parentName !== undefined) { + if ( + this.organization.canViewAllCollections && + !allCollections.find((c) => c.name === parentName) + ) { + // The user can view all collections, but the parent was not found -> assume it has been deleted + this.deletedParentName = parentName; + } else if (!this.nestOptions.find((c) => c.name === parentName)) { + // We cannot find the current parent collection in our list of options, so add a placeholder + this.nestOptions.unshift({ name: parentName } as CollectionView); + } } - this.formGroup.controls.access.updateValueAndValidity(); - this.handleFormGroupReadonly(this.dialogReadonly); + const accessSelections = mapToAccessSelections(this.collection); + this.formGroup.patchValue({ + name, + externalId: this.collection.externalId, + parent: parentName, + access: accessSelections, + }); + this.showDeleteButton = !this.dialogReadonly && this.collection.canDelete(organization); + } else { + const parent = this.nestOptions.find((c) => c.id === this.params.parentCollectionId); + const currentOrgUserId = users.data.find( + (u) => u.userId === this.organization?.userId, + )?.id; + const initialSelection: AccessItemValue[] = + currentOrgUserId !== undefined + ? [ + { + id: currentOrgUserId, + type: AccessItemType.Member, + permission: CollectionPermission.Manage, + }, + ] + : []; - this.loading = false; - this.showAddAccessWarning = this.handleAddAccessWarning(flexibleCollectionsV1); - }, - ); + this.formGroup.patchValue({ + parent: parent?.name ?? undefined, + access: initialSelection, + }); + } + + if (!organization.allowAdminAccessToAllCollectionItems) { + this.formGroup.controls.access.addValidators(validateCanManagePermission); + } else { + this.formGroup.controls.access.removeValidators(validateCanManagePermission); + } + this.formGroup.controls.access.updateValueAndValidity(); + + this.handleFormGroupReadonly(this.dialogReadonly); + + this.loading = false; + this.showAddAccessWarning = this.handleAddAccessWarning(); + }); } protected get collectionId() { @@ -361,9 +349,8 @@ export class CollectionDialogComponent implements OnInit, OnDestroy { this.destroy$.complete(); } - private handleAddAccessWarning(flexibleCollectionsV1: boolean): boolean { + private handleAddAccessWarning(): boolean { if ( - flexibleCollectionsV1 && !this.organization?.allowAdminAccessToAllCollectionItems && this.params.isAddAccessCollection ) { 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 873bdd3e1a..b5f910cd1a 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() flexibleCollectionsV1Enabled: boolean; @Input() restrictProviderAccess: boolean; @Output() onEvent = new EventEmitter(); @@ -57,10 +56,6 @@ export class VaultCollectionRowComponent { } get showAddAccess() { - if (!this.flexibleCollectionsV1Enabled) { - return false; - } - if (this.collection.id == Unassigned) { return false; } @@ -71,7 +66,7 @@ export class VaultCollectionRowComponent { return ( !this.organization?.allowAdminAccessToAllCollectionItems && this.collection.unmanaged && - this.organization?.canEditUnmanagedCollections() + this.organization?.canEditUnmanagedCollections ); } @@ -114,10 +109,6 @@ export class VaultCollectionRowComponent { } protected get showCheckbox() { - if (this.flexibleCollectionsV1Enabled) { - return this.collection?.id !== Unassigned; - } - - return this.canDeleteCollection; + return this.collection?.id !== Unassigned; } } 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 a4f41d2507..2f294a758d 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 @@ -113,7 +113,6 @@ [canDeleteCollection]="canDeleteCollection(item.collection)" [canEditCollection]="canEditCollection(item.collection)" [canViewCollectionInfo]="canViewCollectionInfo(item.collection)" - [flexibleCollectionsV1Enabled]="flexibleCollectionsV1Enabled" [restrictProviderAccess]="restrictProviderAccess" [checked]="selection.isSelected(item)" (checkedToggled)="selection.toggle(item)" 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 bfb30f3f76..2709091b0c 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 @@ -44,7 +44,6 @@ export class VaultItemsComponent { @Input() showBulkAddToCollections = false; @Input() showPermissionsColumn = false; @Input() viewingOrgVault: boolean; - @Input({ required: true }) flexibleCollectionsV1Enabled = false; @Input() addAccessStatus: number; @Input() addAccessToggle: boolean; @Input() restrictProviderAccess: boolean; @@ -120,7 +119,7 @@ export class VaultItemsComponent { const organization = this.allOrganizations.find((o) => o.id === collection.organizationId); - return collection.canEdit(organization, this.flexibleCollectionsV1Enabled); + return collection.canEdit(organization); } protected canDeleteCollection(collection: CollectionView): boolean { @@ -131,12 +130,12 @@ export class VaultItemsComponent { const organization = this.allOrganizations.find((o) => o.id === collection.organizationId); - return collection.canDelete(organization, this.flexibleCollectionsV1Enabled); + return collection.canDelete(organization); } protected canViewCollectionInfo(collection: CollectionView) { const organization = this.allOrganizations.find((o) => o.id === collection.organizationId); - return collection.canViewCollectionInfo(organization, this.flexibleCollectionsV1Enabled); + return collection.canViewCollectionInfo(organization); } protected toggleAll() { @@ -214,11 +213,7 @@ export class VaultItemsComponent { const organization = this.allOrganizations.find((o) => o.id === cipher.organizationId); return ( - (organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) && - this.viewingOrgVault) || + (organization.canEditAllCiphers(this.restrictProviderAccess) && this.viewingOrgVault) || cipher.edit ); } @@ -230,21 +225,12 @@ export class VaultItemsComponent { this.selection.clear(); - if (this.flexibleCollectionsV1Enabled) { - // Every item except for the Unassigned collection is selectable, individual bulk actions check the user's permission - this.editableItems = items.filter( - (item) => - item.cipher !== undefined || - (item.collection !== undefined && item.collection.id !== Unassigned), - ); - } else { - // only collections the user can delete are selectable - this.editableItems = items.filter( - (item) => - item.cipher !== undefined || - (item.collection !== undefined && this.canDeleteCollection(item.collection)), - ); - } + // Every item except for the Unassigned collection is selectable, individual bulk actions check the user's permission + this.editableItems = items.filter( + (item) => + item.cipher !== undefined || + (item.collection !== undefined && item.collection.id !== Unassigned), + ); this.dataSource.data = items; } @@ -293,10 +279,7 @@ export class VaultItemsComponent { const organization = this.allOrganizations.find((o) => o.id === orgId); const canEditOrManageAllCiphers = - organization?.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) && this.viewingOrgVault; + organization?.canEditAllCiphers(this.restrictProviderAccess) && this.viewingOrgVault; const collectionNotSelected = this.selection.selected.filter((item) => item.collection).length === 0; @@ -317,9 +300,7 @@ export class VaultItemsComponent { const canEditOrManageAllCiphers = organizations.length > 0 && - organizations.every((org) => - org?.canEditAllCiphers(this.flexibleCollectionsV1Enabled, this.restrictProviderAccess), - ); + organizations.every((org) => org?.canEditAllCiphers(this.restrictProviderAccess)); const canDeleteCollections = this.selection.selected .filter((item) => item.collection) diff --git a/apps/web/src/app/vault/core/views/collection-admin.view.ts b/apps/web/src/app/vault/core/views/collection-admin.view.ts index 6e842023d3..10f894505c 100644 --- a/apps/web/src/app/vault/core/views/collection-admin.view.ts +++ b/apps/web/src/app/vault/core/views/collection-admin.view.ts @@ -41,61 +41,44 @@ export class CollectionAdminView extends CollectionView { /** * Returns true if the user can edit a collection (including user and group access) from the Admin Console. */ - override canEdit(org: Organization, flexibleCollectionsV1Enabled: boolean): boolean { + override canEdit(org: Organization): boolean { return ( - org?.canEditAnyCollection(flexibleCollectionsV1Enabled) || - (flexibleCollectionsV1Enabled && this.unmanaged && org?.canEditUnmanagedCollections()) || - super.canEdit(org, flexibleCollectionsV1Enabled) + org?.canEditAnyCollection || + (this.unmanaged && org?.canEditUnmanagedCollections) || + super.canEdit(org) ); } /** * Returns true if the user can delete a collection from the Admin Console. */ - override canDelete(org: Organization, flexibleCollectionsV1Enabled: boolean): boolean { - return ( - org?.canDeleteAnyCollection(flexibleCollectionsV1Enabled) || - super.canDelete(org, flexibleCollectionsV1Enabled) - ); + override canDelete(org: Organization): boolean { + return org?.canDeleteAnyCollection || super.canDelete(org); } /** * Whether the user can modify user access to this collection */ - canEditUserAccess(org: Organization, flexibleCollectionsV1Enabled: boolean): boolean { - const allowAdminAccessToAllCollectionItems = - !flexibleCollectionsV1Enabled || org.allowAdminAccessToAllCollectionItems; - + canEditUserAccess(org: Organization): boolean { return ( - (org.permissions.manageUsers && allowAdminAccessToAllCollectionItems) || - this.canEdit(org, flexibleCollectionsV1Enabled) + (org.permissions.manageUsers && org.allowAdminAccessToAllCollectionItems) || this.canEdit(org) ); } /** * Whether the user can modify group access to this collection */ - canEditGroupAccess(org: Organization, flexibleCollectionsV1Enabled: boolean): boolean { - const allowAdminAccessToAllCollectionItems = - !flexibleCollectionsV1Enabled || org.allowAdminAccessToAllCollectionItems; - + canEditGroupAccess(org: Organization): boolean { return ( - (org.permissions.manageGroups && allowAdminAccessToAllCollectionItems) || - this.canEdit(org, flexibleCollectionsV1Enabled) + (org.permissions.manageGroups && org.allowAdminAccessToAllCollectionItems) || + this.canEdit(org) ); } /** * Returns true if the user can view collection info and access in a read-only state from the Admin Console */ - override canViewCollectionInfo( - org: Organization | undefined, - flexibleCollectionsV1Enabled: boolean, - ): boolean { - if (!flexibleCollectionsV1Enabled) { - return false; - } - + override canViewCollectionInfo(org: Organization | undefined): boolean { if (this.isUnassignedCollection) { return false; } 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 c0de8c6bd2..617628a0b3 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 @@ -54,10 +54,6 @@ export class BulkDeleteDialogComponent { collections: CollectionView[]; unassignedCiphers: string[]; - private flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$( - FeatureFlag.FlexibleCollectionsV1, - ); - private restrictProviderAccess$ = this.configService.getFeatureFlag$( FeatureFlag.RestrictProviderAccess, ); @@ -96,13 +92,9 @@ export class BulkDeleteDialogComponent { deletePromises.push(this.deleteCiphersAdmin(this.unassignedCiphers)); } if (this.cipherIds.length) { - const flexibleCollectionsV1Enabled = await firstValueFrom(this.flexibleCollectionsV1Enabled$); const restrictProviderAccess = await firstValueFrom(this.restrictProviderAccess$); - if ( - !this.organization || - !this.organization.canEditAllCiphers(flexibleCollectionsV1Enabled, restrictProviderAccess) - ) { + if (!this.organization || !this.organization.canEditAllCiphers(restrictProviderAccess)) { deletePromises.push(this.deleteCiphers()); } else { deletePromises.push(this.deleteCiphersAdmin(this.cipherIds)); @@ -134,12 +126,8 @@ export class BulkDeleteDialogComponent { }; private async deleteCiphers(): Promise { - const flexibleCollectionsV1Enabled = await firstValueFrom(this.flexibleCollectionsV1Enabled$); const restrictProviderAccess = await firstValueFrom(this.restrictProviderAccess$); - const asAdmin = this.organization?.canEditAllCiphers( - flexibleCollectionsV1Enabled, - restrictProviderAccess, - ); + const asAdmin = this.organization?.canEditAllCiphers(restrictProviderAccess); if (this.permanent) { await this.cipherService.deleteManyWithServer(this.cipherIds, asAdmin); } else { @@ -157,12 +145,9 @@ export class BulkDeleteDialogComponent { } private async deleteCollections(): Promise { - const flexibleCollectionsV1Enabled = await firstValueFrom(this.flexibleCollectionsV1Enabled$); // From org vault if (this.organization) { - if ( - this.collections.some((c) => !c.canDelete(this.organization, flexibleCollectionsV1Enabled)) - ) { + if (this.collections.some((c) => !c.canDelete(this.organization))) { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), @@ -179,7 +164,7 @@ export class BulkDeleteDialogComponent { const deletePromises: Promise[] = []; for (const organization of this.organizations) { const orgCollections = this.collections.filter((o) => o.organizationId === organization.id); - if (orgCollections.some((c) => !c.canDelete(organization, flexibleCollectionsV1Enabled))) { + if (orgCollections.some((c) => !c.canDelete(organization))) { this.platformUtilsService.showToast( "error", this.i18nService.t("errorOccurred"), 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 d9c2145f0b..e4029ef866 100644 --- a/apps/web/src/app/vault/individual-vault/collections.component.html +++ b/apps/web/src/app/vault/individual-vault/collections.component.html @@ -32,13 +32,7 @@ [(ngModel)]="$any(c).checked" name="Collection[{{ i }}].Checked" appStopProp - [disabled]=" - !c.canEditItems( - this.organization, - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess - ) - " + [disabled]="!c.canEditItems(this.organization, this.restrictProviderAccess)" /> {{ 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 af9c3476bd..9795f87977 100644 --- a/apps/web/src/app/vault/individual-vault/collections.component.ts +++ b/apps/web/src/app/vault/individual-vault/collections.component.ts @@ -50,13 +50,7 @@ export class CollectionsComponent extends BaseCollectionsComponent implements On } check(c: CollectionView, select?: boolean) { - if ( - !c.canEditItems( - this.organization, - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) - ) { + if (!c.canEditItems(this.organization, this.restrictProviderAccess)) { return; } (c as any).checked = select == null ? !(c as any).checked : select; diff --git a/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts b/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts index ad07d2847e..403dbd2f67 100644 --- a/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault-header/vault-header.component.ts @@ -84,17 +84,12 @@ export class VaultHeaderComponent implements OnInit { /** Emits an event when the delete collection button is clicked in the header */ @Output() onDeleteCollection = new EventEmitter(); - private flexibleCollectionsV1Enabled = false; - constructor( private i18nService: I18nService, private configService: ConfigService, ) {} async ngOnInit() { - this.flexibleCollectionsV1Enabled = await firstValueFrom( - this.configService.getFeatureFlag$(FeatureFlag.FlexibleCollectionsV1), - ); this.extensionRefreshEnabled = await firstValueFrom( this.configService.getFeatureFlag$(FeatureFlag.ExtensionRefresh), ); @@ -180,7 +175,7 @@ export class VaultHeaderComponent implements OnInit { const organization = this.organizations.find( (o) => o.id === this.collection?.node.organizationId, ); - return this.collection.node.canEdit(organization, this.flexibleCollectionsV1Enabled); + return this.collection.node.canEdit(organization); } async editCollection(tab: CollectionDialogTabType): Promise { @@ -198,7 +193,7 @@ export class VaultHeaderComponent implements OnInit { (o) => o.id === this.collection?.node.organizationId, ); - return this.collection.node.canDelete(organization, this.flexibleCollectionsV1Enabled); + return this.collection.node.canDelete(organization); } deleteCollection() { diff --git a/apps/web/src/app/vault/individual-vault/vault.component.html b/apps/web/src/app/vault/individual-vault/vault.component.html index 183c4f65af..b19a4509c1 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.html +++ b/apps/web/src/app/vault/individual-vault/vault.component.html @@ -56,7 +56,6 @@ [showAdminActions]="false" [showBulkAddToCollections]="vaultBulkManagementActionEnabled$ | async" (onEvent)="onVaultItemsEvent($event)" - [flexibleCollectionsV1Enabled]="flexibleCollectionsV1Enabled$ | async" [vaultBulkManagementActionEnabled]="vaultBulkManagementActionEnabled$ | async" > 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 1b9d0e1b62..469fad05a8 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -158,9 +158,6 @@ export class VaultComponent implements OnInit, OnDestroy { protected selectedCollection: TreeNode | undefined; protected canCreateCollections = false; protected currentSearchText$: Observable; - protected flexibleCollectionsV1Enabled$ = this.configService.getFeatureFlag$( - FeatureFlag.FlexibleCollectionsV1, - ); protected vaultBulkManagementActionEnabled$ = this.configService.getFeatureFlag$( FeatureFlag.VaultBulkManagementAction, ); @@ -552,7 +549,7 @@ export class VaultComponent implements OnInit, OnDestroy { } async shareCipher(cipher: CipherView) { - if ((await this.flexibleCollectionsV1Enabled()) && cipher.organizationId != null) { + if (cipher.organizationId != null) { // You cannot move ciphers between organizations this.showMissingPermissionsError(); return; @@ -712,8 +709,7 @@ export class VaultComponent implements OnInit, OnDestroy { async deleteCollection(collection: CollectionView): Promise { const organization = await this.organizationService.get(collection.organizationId); - const flexibleCollectionsV1Enabled = await firstValueFrom(this.flexibleCollectionsV1Enabled$); - if (!collection.canDelete(organization, flexibleCollectionsV1Enabled)) { + if (!collection.canDelete(organization)) { this.showMissingPermissionsError(); return; } @@ -811,7 +807,7 @@ export class VaultComponent implements OnInit, OnDestroy { return; } - if ((await this.flexibleCollectionsV1Enabled()) && !c.edit) { + if (!c.edit) { this.showMissingPermissionsError(); return; } @@ -834,7 +830,7 @@ export class VaultComponent implements OnInit, OnDestroy { } async bulkRestore(ciphers: CipherView[]) { - if ((await this.flexibleCollectionsV1Enabled()) && ciphers.some((c) => !c.edit)) { + if (ciphers.some((c) => !c.edit)) { this.showMissingPermissionsError(); return; } @@ -887,7 +883,7 @@ export class VaultComponent implements OnInit, OnDestroy { return; } - if ((await this.flexibleCollectionsV1Enabled()) && !c.edit) { + if (!c.edit) { this.showMissingPermissionsError(); return; } @@ -936,19 +932,12 @@ export class VaultComponent implements OnInit, OnDestroy { return; } - const flexibleCollectionsV1Enabled = await this.flexibleCollectionsV1Enabled(); - const canDeleteCollections = collections == null || - collections.every((c) => - c.canDelete( - organizations.find((o) => o.id == c.organizationId), - flexibleCollectionsV1Enabled, - ), - ); + collections.every((c) => c.canDelete(organizations.find((o) => o.id == c.organizationId))); const canDeleteCiphers = ciphers == null || ciphers.every((c) => c.edit); - if (flexibleCollectionsV1Enabled && (!canDeleteCollections || !canDeleteCiphers)) { + if (!canDeleteCollections || !canDeleteCiphers) { this.showMissingPermissionsError(); return; } @@ -1052,10 +1041,7 @@ export class VaultComponent implements OnInit, OnDestroy { return; } - if ( - (await this.flexibleCollectionsV1Enabled()) && - ciphers.some((c) => c.organizationId != null) - ) { + if (ciphers.some((c) => c.organizationId != null)) { // You cannot move ciphers between organizations this.showMissingPermissionsError(); return; @@ -1099,10 +1085,8 @@ export class VaultComponent implements OnInit, OnDestroy { return true; } - const flexibleCollectionsV1Enabled = await this.flexibleCollectionsV1Enabled(); - const organization = this.allOrganizations.find((o) => o.id === cipher.organizationId); - return organization.canEditAllCiphers(flexibleCollectionsV1Enabled, false); + return organization.canEditAllCiphers(false); } private go(queryParams: any = null) { @@ -1131,10 +1115,6 @@ export class VaultComponent implements OnInit, OnDestroy { message: this.i18nService.t("missingPermissions"), }); } - - private flexibleCollectionsV1Enabled() { - return firstValueFrom(this.flexibleCollectionsV1Enabled$); - } } /** 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 c0a83ed74c..8fd15cf20e 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 @@ -82,12 +82,7 @@ export class AddEditComponent extends BaseAddEditComponent { } protected loadCollections() { - if ( - !this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) - ) { + if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { return super.loadCollections(); } return Promise.resolve(this.collections); @@ -98,10 +93,7 @@ export class AddEditComponent extends BaseAddEditComponent { const firstCipherCheck = await super.loadCipher(); if ( - !this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) && + !this.organization.canEditAllCiphers(this.restrictProviderAccess) && firstCipherCheck != null ) { return firstCipherCheck; @@ -116,24 +108,14 @@ export class AddEditComponent extends BaseAddEditComponent { } protected encryptCipher() { - if ( - !this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) - ) { + if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { return super.encryptCipher(); } return this.cipherService.encrypt(this.cipher, null, null, this.originalCipher); } protected async deleteCipher() { - if ( - !this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) - ) { + if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { 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 30189e8021..71e7842913 100644 --- a/apps/web/src/app/vault/org-vault/attachments.component.ts +++ b/apps/web/src/app/vault/org-vault/attachments.component.ts @@ -28,7 +28,6 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On viewOnly = false; organization: Organization; - private flexibleCollectionsV1Enabled = false; private restrictProviderAccess = false; constructor( @@ -60,9 +59,6 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On async ngOnInit() { await super.ngOnInit(); - this.flexibleCollectionsV1Enabled = await firstValueFrom( - this.configService.getFeatureFlag$(FeatureFlag.FlexibleCollectionsV1), - ); this.restrictProviderAccess = await firstValueFrom( this.configService.getFeatureFlag$(FeatureFlag.RestrictProviderAccess), ); @@ -70,10 +66,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On protected async reupload(attachment: AttachmentView) { if ( - this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) && + this.organization.canEditAllCiphers(this.restrictProviderAccess) && this.showFixOldAttachments(attachment) ) { await super.reuploadCipherAttachment(attachment, true); @@ -81,12 +74,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On } protected async loadCipher() { - if ( - !this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) - ) { + if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { return await super.loadCipher(); } const response = await this.apiService.getCipherAdmin(this.cipherId); @@ -97,20 +85,12 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On return this.cipherService.saveAttachmentWithServer( this.cipherDomain, file, - this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ), + this.organization.canEditAllCiphers(this.restrictProviderAccess), ); } protected deleteCipherAttachment(attachmentId: string) { - if ( - !this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) - ) { + if (!this.organization.canEditAllCiphers(this.restrictProviderAccess)) { return super.deleteCipherAttachment(attachmentId); } return this.apiService.deleteCipherAttachmentAdmin(this.cipherId, attachmentId); @@ -118,11 +98,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent implements On protected showFixOldAttachments(attachment: AttachmentView) { return ( - attachment.key == null && - this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) + attachment.key == null && this.organization.canEditAllCiphers(this.restrictProviderAccess) ); } } 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 557b048a7b..4ee052e32f 100644 --- a/apps/web/src/app/vault/org-vault/collections.component.ts +++ b/apps/web/src/app/vault/org-vault/collections.component.ts @@ -61,10 +61,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.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) && + !this.organization.canEditAllCiphers(this.restrictProviderAccess) && this.collectionIds.length !== 0 ) { return await super.loadCipher(); @@ -89,10 +86,7 @@ export class CollectionsComponent extends BaseCollectionsComponent { protected saveCollections() { if ( - this.organization.canEditAllCiphers( - this.flexibleCollectionsV1Enabled, - this.restrictProviderAccess, - ) || + this.organization.canEditAllCiphers(this.restrictProviderAccess) || this.collectionIds.length === 0 ) { const request = new CipherCollectionsRequest(this.cipherDomain.collectionIds); diff --git a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts index 31764fcf05..56fb2e4cec 100644 --- a/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts +++ b/apps/web/src/app/vault/org-vault/vault-header/vault-header.component.ts @@ -87,7 +87,6 @@ export class VaultHeaderComponent implements OnInit { protected CollectionDialogTabType = CollectionDialogTabType; protected organizations$ = this.organizationService.organizations$; - protected flexibleCollectionsV1Enabled = false; protected restrictProviderAccessFlag = false; constructor( @@ -100,9 +99,6 @@ export class VaultHeaderComponent implements OnInit { ) {} async ngOnInit() { - this.flexibleCollectionsV1Enabled = await firstValueFrom( - this.configService.getFeatureFlag$(FeatureFlag.FlexibleCollectionsV1), - ); this.restrictProviderAccessFlag = await this.configService.getFeatureFlag( FeatureFlag.RestrictProviderAccess, ); @@ -195,7 +191,7 @@ export class VaultHeaderComponent implements OnInit { } // Otherwise, check if we can edit the specified collection - return this.collection.node.canEdit(this.organization, this.flexibleCollectionsV1Enabled); + return this.collection.node.canEdit(this.organization); } addCipher() { @@ -225,14 +221,11 @@ export class VaultHeaderComponent implements OnInit { } // Otherwise, check if we can delete the specified collection - return this.collection.node.canDelete(this.organization, this.flexibleCollectionsV1Enabled); + return this.collection.node.canDelete(this.organization); } get canViewCollectionInfo(): boolean { - return this.collection.node.canViewCollectionInfo( - this.organization, - this.flexibleCollectionsV1Enabled, - ); + return this.collection.node.canViewCollectionInfo(this.organization); } get canCreateCollection(): boolean { diff --git a/apps/web/src/app/vault/org-vault/vault.component.html b/apps/web/src/app/vault/org-vault/vault.component.html index 881b0948c0..b27c0234a5 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.html +++ b/apps/web/src/app/vault/org-vault/vault.component.html @@ -68,39 +68,12 @@ [showBulkEditCollectionAccess]="true" [showBulkAddToCollections]="true" [viewingOrgVault]="true" - [flexibleCollectionsV1Enabled]="flexibleCollectionsV1Enabled" [addAccessStatus]="addAccessStatus$ | async" [addAccessToggle]="showAddAccessToggle" [restrictProviderAccess]="restrictProviderAccessEnabled" > - -
- -

{{ "noPermissionToViewAllCollectionItems" | i18n }}

-
-
- -

{{ "noItemsInList" | i18n }}

- -
- + {{ "noItemsInList" | i18n }}