mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
premium check for attachments
This commit is contained in:
parent
87a216e523
commit
2afef85f85
@ -109,11 +109,21 @@ namespace Bit.Core.Services
|
|||||||
if(cipher.UserId.HasValue)
|
if(cipher.UserId.HasValue)
|
||||||
{
|
{
|
||||||
var user = await _userRepository.GetByIdAsync(cipher.UserId.Value);
|
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();
|
storageBytesRemaining = user.StorageBytesRemaining();
|
||||||
}
|
}
|
||||||
else if(cipher.OrganizationId.HasValue)
|
else if(cipher.OrganizationId.HasValue)
|
||||||
{
|
{
|
||||||
var org = await _organizationRepository.GetByIdAsync(cipher.OrganizationId.Value);
|
var org = await _organizationRepository.GetByIdAsync(cipher.OrganizationId.Value);
|
||||||
|
if(!org.MaxStorageGb.HasValue)
|
||||||
|
{
|
||||||
|
throw new BadRequestException("This organization cannot use attachments.");
|
||||||
|
}
|
||||||
|
|
||||||
storageBytesRemaining = org.StorageBytesRemaining();
|
storageBytesRemaining = org.StorageBytesRemaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user