mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 00:52:49 -05:00
[PM-19383] add admin endpoint, fix typecasting error (#5681)
* add admin endpoint, fix typecasting error * fix typecast issue * wip * cleanup
This commit is contained in:
@ -379,7 +379,7 @@ public class CipherService : ICipherService
|
||||
if (!valid || realSize > MAX_FILE_SIZE)
|
||||
{
|
||||
// File reported differs in size from that promised. Must be a rogue client. Delete Send
|
||||
await DeleteAttachmentAsync(cipher, attachmentData);
|
||||
await DeleteAttachmentAsync(cipher, attachmentData, false);
|
||||
return false;
|
||||
}
|
||||
// Update Send data if necessary
|
||||
@ -483,7 +483,7 @@ public class CipherService : ICipherService
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
return await DeleteAttachmentAsync(cipher, cipher.GetAttachments()[attachmentId]);
|
||||
return await DeleteAttachmentAsync(cipher, cipher.GetAttachments()[attachmentId], orgAdmin);
|
||||
}
|
||||
|
||||
public async Task PurgeAsync(Guid organizationId)
|
||||
@ -877,7 +877,7 @@ public class CipherService : ICipherService
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<DeleteAttachmentResponseData> DeleteAttachmentAsync(Cipher cipher, CipherAttachment.MetaData attachmentData)
|
||||
private async Task<DeleteAttachmentResponseData> DeleteAttachmentAsync(Cipher cipher, CipherAttachment.MetaData attachmentData, bool orgAdmin)
|
||||
{
|
||||
if (attachmentData == null || string.IsNullOrWhiteSpace(attachmentData.AttachmentId))
|
||||
{
|
||||
@ -891,7 +891,7 @@ public class CipherService : ICipherService
|
||||
|
||||
// Update the revision date when an attachment is deleted
|
||||
cipher.RevisionDate = DateTime.UtcNow;
|
||||
await _cipherRepository.ReplaceAsync((CipherDetails)cipher);
|
||||
await _cipherRepository.ReplaceAsync(orgAdmin ? cipher : (CipherDetails)cipher);
|
||||
|
||||
// push
|
||||
await _pushService.PushSyncCipherUpdateAsync(cipher, null);
|
||||
|
Reference in New Issue
Block a user