mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 23:03:32 +00:00
premium and enc key checks
This commit is contained in:
@@ -2,11 +2,13 @@ import * as program from 'commander';
|
||||
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||
import { TokenService } from 'jslib/abstractions/token.service';
|
||||
|
||||
import { Response } from '../models/response';
|
||||
|
||||
export class DeleteCommand {
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService) { }
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||
private tokenService: TokenService) { }
|
||||
|
||||
async run(object: string, id: string, cmd: program.Command): Promise<Response> {
|
||||
if (id != null) {
|
||||
@@ -59,6 +61,10 @@ export class DeleteCommand {
|
||||
return Response.error('Attachment `' + id + '` was not found.');
|
||||
}
|
||||
|
||||
if (cipher.organizationId == null && !this.tokenService.getPremium()) {
|
||||
return Response.error('A premium membership is required to use this feature.');
|
||||
}
|
||||
|
||||
try {
|
||||
await this.cipherService.deleteAttachmentWithServer(cipher.id, attachments[0].id);
|
||||
return Response.success();
|
||||
|
||||
Reference in New Issue
Block a user