1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 16:12:49 -05:00

folder permission checks and null folder

This commit is contained in:
Kyle Spearrin
2017-06-09 09:48:44 -04:00
parent d3073e675e
commit f24bc96846
6 changed files with 15 additions and 6 deletions

View File

@ -106,8 +106,17 @@ namespace Bit.Core.Services
await _pushService.PushSyncCiphersAsync(deletingUserId);
}
public async Task MoveManyAsync(IEnumerable<Guid> cipherIds, Guid destinationFolderId, Guid movingUserId)
public async Task MoveManyAsync(IEnumerable<Guid> cipherIds, Guid? destinationFolderId, Guid movingUserId)
{
if(destinationFolderId.HasValue)
{
var folder = await _folderRepository.GetByIdAsync(destinationFolderId.Value);
if(folder == null || folder.UserId != movingUserId)
{
throw new BadRequestException("Invalid folder.");
}
}
await _cipherRepository.MoveAsync(cipherIds, destinationFolderId, movingUserId);
// push
await _pushService.PushSyncCiphersAsync(movingUserId);