mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
attachments accessible if can access premium
This commit is contained in:
parent
3fa63ee2c2
commit
cfe3d9ae5f
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit 81c21418ec965221b4d322008f9da0ab7b9037d0
|
Subproject commit 42dbdb0043842810fb084370f886bd2ea9406b9f
|
@ -5,7 +5,7 @@ import * as path from 'path';
|
|||||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||||
import { TokenService } from 'jslib/abstractions/token.service';
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
|
||||||
import { Response } from '../models/response';
|
import { Response } from '../models/response';
|
||||||
import { CipherResponse } from '../models/response/cipherResponse';
|
import { CipherResponse } from '../models/response/cipherResponse';
|
||||||
@ -18,7 +18,7 @@ import { CliUtils } from '../utils';
|
|||||||
|
|
||||||
export class CreateCommand {
|
export class CreateCommand {
|
||||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||||
private tokenService: TokenService, private cryptoService: CryptoService) { }
|
private userService: UserService, private cryptoService: CryptoService) { }
|
||||||
|
|
||||||
async run(object: string, requestJson: string, cmd: program.Command): Promise<Response> {
|
async run(object: string, requestJson: string, cmd: program.Command): Promise<Response> {
|
||||||
let req: any = null;
|
let req: any = null;
|
||||||
@ -82,8 +82,8 @@ export class CreateCommand {
|
|||||||
return Response.notFound();
|
return Response.notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cipher.organizationId == null && !this.tokenService.getPremium()) {
|
if (cipher.organizationId == null && !(await this.userService.canAccessPremium())) {
|
||||||
return Response.error('A premium membership is required to use this feature.');
|
return Response.error('Premium status is required to use this feature.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const encKey = await this.cryptoService.getEncKey();
|
const encKey = await this.cryptoService.getEncKey();
|
||||||
|
@ -2,13 +2,13 @@ import * as program from 'commander';
|
|||||||
|
|
||||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||||
import { TokenService } from 'jslib/abstractions/token.service';
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
|
||||||
import { Response } from '../models/response';
|
import { Response } from '../models/response';
|
||||||
|
|
||||||
export class DeleteCommand {
|
export class DeleteCommand {
|
||||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||||
private tokenService: TokenService) { }
|
private userService: UserService) { }
|
||||||
|
|
||||||
async run(object: string, id: string, cmd: program.Command): Promise<Response> {
|
async run(object: string, id: string, cmd: program.Command): Promise<Response> {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
@ -61,8 +61,8 @@ export class DeleteCommand {
|
|||||||
return Response.error('Attachment `' + id + '` was not found.');
|
return Response.error('Attachment `' + id + '` was not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cipher.organizationId == null && !this.tokenService.getPremium()) {
|
if (cipher.organizationId == null && !(await this.userService.canAccessPremium())) {
|
||||||
return Response.error('A premium membership is required to use this feature.');
|
return Response.error('Premium status is required to use this feature.');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -9,7 +9,6 @@ import { CollectionService } from 'jslib/abstractions/collection.service';
|
|||||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||||
import { SearchService } from 'jslib/abstractions/search.service';
|
import { SearchService } from 'jslib/abstractions/search.service';
|
||||||
import { TokenService } from 'jslib/abstractions/token.service';
|
|
||||||
import { TotpService } from 'jslib/abstractions/totp.service';
|
import { TotpService } from 'jslib/abstractions/totp.service';
|
||||||
import { UserService } from 'jslib/abstractions/user.service';
|
import { UserService } from 'jslib/abstractions/user.service';
|
||||||
|
|
||||||
@ -44,8 +43,7 @@ export class GetCommand {
|
|||||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||||
private collectionService: CollectionService, private totpService: TotpService,
|
private collectionService: CollectionService, private totpService: TotpService,
|
||||||
private auditService: AuditService, private cryptoService: CryptoService,
|
private auditService: AuditService, private cryptoService: CryptoService,
|
||||||
private tokenService: TokenService, private userService: UserService,
|
private userService: UserService, private searchService: SearchService) { }
|
||||||
private searchService: SearchService) { }
|
|
||||||
|
|
||||||
async run(object: string, id: string, cmd: program.Command): Promise<Response> {
|
async run(object: string, id: string, cmd: program.Command): Promise<Response> {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
@ -231,10 +229,10 @@ export class GetCommand {
|
|||||||
return Response.multipleResults(attachments.map((a) => a.id));
|
return Response.multipleResults(attachments.map((a) => a.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.tokenService.getPremium()) {
|
if (!(await this.userService.canAccessPremium())) {
|
||||||
const originalCipher = await this.cipherService.get(cipher.id);
|
const originalCipher = await this.cipherService.get(cipher.id);
|
||||||
if (originalCipher == null || originalCipher.organizationId == null) {
|
if (originalCipher == null || originalCipher.organizationId == null) {
|
||||||
return Response.error('A premium membership is required to use this feature.');
|
return Response.error('Premium status is required to use this feature.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user