1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-30 13:33:24 +01:00

remove unnecessary update partial cipher service

This commit is contained in:
Kyle Spearrin 2017-04-17 23:16:35 -04:00
parent f7aa6fadbf
commit 3459be8143
3 changed files with 2 additions and 21 deletions

View File

@ -136,7 +136,7 @@ namespace Bit.Api.Controllers
throw new NotFoundException(); throw new NotFoundException();
} }
await _cipherService.UpdatePartialAsync(new Guid(id), userId, cipher.FolderId, !cipher.Favorite); await _cipherRepository.UpdatePartialAsync(new Guid(id), userId, cipher.FolderId, !cipher.Favorite);
} }
[HttpPut("{id}/partial")] [HttpPut("{id}/partial")]
@ -145,7 +145,7 @@ namespace Bit.Api.Controllers
{ {
var userId = _userService.GetProperUserId(User).Value; var userId = _userService.GetProperUserId(User).Value;
var folderId = string.IsNullOrWhiteSpace(model.FolderId) ? null : (Guid?)new Guid(model.FolderId); var folderId = string.IsNullOrWhiteSpace(model.FolderId) ? null : (Guid?)new Guid(model.FolderId);
await _cipherService.UpdatePartialAsync(new Guid(id), userId, folderId, model.Favorite); await _cipherRepository.UpdatePartialAsync(new Guid(id), userId, folderId, model.Favorite);
} }
[HttpPut("{id}/share")] [HttpPut("{id}/share")]

View File

@ -9,7 +9,6 @@ namespace Bit.Core.Services
public interface ICipherService public interface ICipherService
{ {
Task SaveAsync(CipherDetails cipher, Guid savingUserId); Task SaveAsync(CipherDetails cipher, Guid savingUserId);
Task UpdatePartialAsync(Guid cipherId, Guid savingUserId, Guid? folderId, bool favorite);
Task DeleteAsync(CipherDetails cipher, Guid deletingUserId); Task DeleteAsync(CipherDetails cipher, Guid deletingUserId);
Task SaveFolderAsync(Folder folder); Task SaveFolderAsync(Folder folder);
Task DeleteFolderAsync(Folder folder); Task DeleteFolderAsync(Folder folder);

View File

@ -65,16 +65,6 @@ namespace Bit.Core.Services
} }
} }
public async Task UpdatePartialAsync(Guid cipherId, Guid savingUserId, Guid? folderId, bool favorite)
{
if(!(await UserCanPartialEditAsync(cipherId, savingUserId)))
{
throw new BadRequestException("Cannot edit.");
}
await _cipherRepository.UpdatePartialAsync(cipherId, savingUserId, folderId, favorite);
}
public async Task DeleteAsync(CipherDetails cipher, Guid deletingUserId) public async Task DeleteAsync(CipherDetails cipher, Guid deletingUserId)
{ {
if(!(await UserCanEditAsync(cipher, deletingUserId))) if(!(await UserCanEditAsync(cipher, deletingUserId)))
@ -225,13 +215,5 @@ namespace Bit.Core.Services
return await _subvaultUserRepository.GetCanEditByUserIdCipherIdAsync(userId, cipher.Id); return await _subvaultUserRepository.GetCanEditByUserIdCipherIdAsync(userId, cipher.Id);
} }
private Task<bool> UserCanPartialEditAsync(Guid cipherId, Guid userId)
{
// TODO: implement
return Task.FromResult(true);
//return await _subvaultUserRepository.GetCanEditByUserIdCipherIdAsync(userId, cipherId);
}
} }
} }