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

admin subvault updates for cipher

This commit is contained in:
Kyle Spearrin
2017-04-17 23:12:48 -04:00
parent 0e5799f7c8
commit f7aa6fadbf
13 changed files with 106 additions and 102 deletions

View File

@ -176,7 +176,22 @@ namespace Bit.Api.Controllers
throw new NotFoundException();
}
await _cipherService.SaveSubvaultsAsync(cipher, model.SubvaultIds.Select(s => new Guid(s)), userId);
await _cipherService.SaveSubvaultsAsync(cipher, model.SubvaultIds.Select(s => new Guid(s)), userId, false);
}
[HttpPut("{id}/subvaults-admin")]
[HttpPost("{id}/subvaults-admin")]
public async Task PutSubvaultsAdmin(string id, [FromBody]CipherSubvaultsRequestModel model)
{
var userId = _userService.GetProperUserId(User).Value;
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id));
if(cipher == null || !cipher.OrganizationId.HasValue ||
!_currentContext.OrganizationAdmin(cipher.OrganizationId.Value))
{
throw new NotFoundException();
}
await _cipherService.SaveSubvaultsAsync(cipher, model.SubvaultIds.Select(s => new Guid(s)), userId, true);
}
[HttpDelete("{id}")]