diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index 713e3e3e353..807767455a5 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -1281,6 +1281,7 @@ export default class MainBackground { this.collectionService, this.organizationService, this.accountService, + this.configService, ); this.inlineMenuFieldQualificationService = new InlineMenuFieldQualificationService(); diff --git a/apps/cli/src/service-container/service-container.ts b/apps/cli/src/service-container/service-container.ts index 3beb01b563b..75a74d42bbd 100644 --- a/apps/cli/src/service-container/service-container.ts +++ b/apps/cli/src/service-container/service-container.ts @@ -845,6 +845,7 @@ export class ServiceContainer { this.collectionService, this.organizationService, this.accountService, + this.configService, ); this.masterPasswordApiService = new MasterPasswordApiService(this.apiService, this.logService); diff --git a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts index 881903e79e5..f7169d9dbd4 100644 --- a/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts +++ b/apps/web/src/app/vault/components/vault-item-dialog/vault-item-dialog.component.ts @@ -15,6 +15,8 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv import { getUserId } from "@bitwarden/common/auth/services/account.service"; import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions"; import { EventType } from "@bitwarden/common/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 { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; @@ -231,7 +233,10 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy { * A user may restore items if they have delete permissions and the item is in the trash. */ protected async canUserRestore() { - return this.isTrashFilter && this.cipher?.isDeleted && this.canDelete; + const featureFlagEnabled = await firstValueFrom(this.limitItemDeletion$); + return this.isTrashFilter && this.cipher?.isDeleted && featureFlagEnabled + ? this.cipher?.permissions.restore + : this.canDelete; } protected showRestore: boolean; @@ -277,6 +282,8 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy { protected canDelete = false; + protected limitItemDeletion$ = this.configService.getFeatureFlag$(FeatureFlag.LimitItemDeletion); + constructor( @Inject(DIALOG_DATA) protected params: VaultItemDialogParams, private dialogRef: DialogRef, @@ -294,6 +301,7 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy { private apiService: ApiService, private eventCollectionService: EventCollectionService, private routedVaultFilterService: RoutedVaultFilterService, + private configService: ConfigService, ) { this.updateTitle(); } diff --git a/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html b/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html index befeee43f69..ef6a347f7d3 100644 --- a/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html +++ b/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html @@ -86,7 +86,12 @@ appStopProp > - - - - -