diff --git a/src/Core/Services/Implementations/CipherService.cs b/src/Core/Services/Implementations/CipherService.cs index 284ad0a53..a5f414af0 100644 --- a/src/Core/Services/Implementations/CipherService.cs +++ b/src/Core/Services/Implementations/CipherService.cs @@ -109,11 +109,21 @@ namespace Bit.Core.Services if(cipher.UserId.HasValue) { var user = await _userRepository.GetByIdAsync(cipher.UserId.Value); + if(!user.Premium) + { + throw new BadRequestException("You must be a premium user to use attachments."); + } + storageBytesRemaining = user.StorageBytesRemaining(); } else if(cipher.OrganizationId.HasValue) { var org = await _organizationRepository.GetByIdAsync(cipher.OrganizationId.Value); + if(!org.MaxStorageGb.HasValue) + { + throw new BadRequestException("This organization cannot use attachments."); + } + storageBytesRemaining = org.StorageBytesRemaining(); }