mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
send revision date with collection edits
This commit is contained in:
parent
3a1e336f8f
commit
94b6f43fc6
@ -215,7 +215,8 @@ namespace Bit.Core.Services
|
|||||||
throw new BadRequestException("Not enough storage available for this organization.");
|
throw new BadRequestException("Not enough storage available for this organization.");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _attachmentStorageService.UploadShareAttachmentAsync(stream, cipher.Id, organizationId, attachmentId);
|
await _attachmentStorageService.UploadShareAttachmentAsync(stream, cipher.Id, organizationId,
|
||||||
|
attachmentId);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -246,7 +247,8 @@ namespace Bit.Core.Services
|
|||||||
await _pushService.PushSyncCiphersAsync(deletingUserId);
|
await _pushService.PushSyncCiphersAsync(deletingUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAttachmentAsync(Cipher cipher, string attachmentId, Guid deletingUserId, bool orgAdmin = false)
|
public async Task DeleteAttachmentAsync(Cipher cipher, string attachmentId, Guid deletingUserId,
|
||||||
|
bool orgAdmin = false)
|
||||||
{
|
{
|
||||||
if(!orgAdmin && !(await UserCanEditAsync(cipher, deletingUserId)))
|
if(!orgAdmin && !(await UserCanEditAsync(cipher, deletingUserId)))
|
||||||
{
|
{
|
||||||
@ -364,7 +366,8 @@ namespace Bit.Core.Services
|
|||||||
// migrate attachments
|
// migrate attachments
|
||||||
foreach(var attachment in attachments)
|
foreach(var attachment in attachments)
|
||||||
{
|
{
|
||||||
await _attachmentStorageService.StartShareAttachmentAsync(cipher.Id, organizationId, attachment.Key);
|
await _attachmentStorageService.StartShareAttachmentAsync(cipher.Id, organizationId,
|
||||||
|
attachment.Key);
|
||||||
migratedAttachments = true;
|
migratedAttachments = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,7 +393,8 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
foreach(var attachment in attachments)
|
foreach(var attachment in attachments)
|
||||||
{
|
{
|
||||||
await _attachmentStorageService.RollbackShareAttachmentAsync(cipher.Id, organizationId, attachment.Key);
|
await _attachmentStorageService.RollbackShareAttachmentAsync(cipher.Id, organizationId,
|
||||||
|
attachment.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _attachmentStorageService.CleanupAsync(cipher.Id);
|
await _attachmentStorageService.CleanupAsync(cipher.Id);
|
||||||
@ -450,7 +454,8 @@ namespace Bit.Core.Services
|
|||||||
await _pushService.PushSyncCiphersAsync(sharingUserId);
|
await _pushService.PushSyncCiphersAsync(sharingUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SaveCollectionsAsync(Cipher cipher, IEnumerable<Guid> collectionIds, Guid savingUserId, bool orgAdmin)
|
public async Task SaveCollectionsAsync(Cipher cipher, IEnumerable<Guid> collectionIds, Guid savingUserId,
|
||||||
|
bool orgAdmin)
|
||||||
{
|
{
|
||||||
if(cipher.Id == default(Guid))
|
if(cipher.Id == default(Guid))
|
||||||
{
|
{
|
||||||
@ -462,11 +467,14 @@ namespace Bit.Core.Services
|
|||||||
throw new BadRequestException("Cipher must belong to an organization.");
|
throw new BadRequestException("Cipher must belong to an organization.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The sprocs will validate that all collections belong to this org/user and that they have proper write permissions.
|
cipher.RevisionDate = DateTime.UtcNow;
|
||||||
|
|
||||||
|
// The sprocs will validate that all collections belong to this org/user and that they have
|
||||||
|
// proper write permissions.
|
||||||
if(orgAdmin)
|
if(orgAdmin)
|
||||||
{
|
{
|
||||||
await _collectionCipherRepository.UpdateCollectionsForAdminAsync(cipher.Id, cipher.OrganizationId.Value,
|
await _collectionCipherRepository.UpdateCollectionsForAdminAsync(cipher.Id,
|
||||||
collectionIds);
|
cipher.OrganizationId.Value, collectionIds);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user