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:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user