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

cipher delete for admin

This commit is contained in:
Kyle Spearrin
2017-04-19 16:00:47 -04:00
parent 552b117821
commit a9b0748d07
3 changed files with 18 additions and 3 deletions

View File

@ -207,5 +207,20 @@ namespace Bit.Api.Controllers
await _cipherService.DeleteAsync(cipher, userId);
}
[HttpDelete("{id}/admin")]
[HttpPost("{id}/delete-admin")]
public async Task DeleteAdmin(string id)
{
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.DeleteAsync(cipher, userId, true);
}
}
}