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

user checks on read procs

This commit is contained in:
Kyle Spearrin
2017-03-21 21:13:20 -04:00
parent ed8d5d69a4
commit d266da1084
8 changed files with 50 additions and 20 deletions

View File

@ -90,10 +90,10 @@ namespace Bit.Api.Controllers
[HttpPut("{id}/move")]
[HttpPost("{id}/move")]
public async Task PostMoveSubvault(string id, [FromBody]CipherMoveRequestModel model)
public async Task PostMove(string id, [FromBody]CipherMoveRequestModel model)
{
var userId = _userService.GetProperUserId(User).Value;
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id));
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
if(cipher == null)
{
throw new NotFoundException();
@ -107,7 +107,8 @@ namespace Bit.Api.Controllers
[HttpPost("{id}/delete")]
public async Task Delete(string id)
{
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), _userService.GetProperUserId(User).Value);
var userId = _userService.GetProperUserId(User).Value;
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), userId);
if(cipher == null)
{
throw new NotFoundException();