Fix: Make sure in use private keys are not deleted
This commit is contained in:
parent
2ec66fd146
commit
6a6b947fba
1 changed files with 4 additions and 0 deletions
|
|
@ -144,6 +144,10 @@ public function storeInFileSystem()
|
||||||
|
|
||||||
public static function deleteFromStorage(self $privateKey)
|
public static function deleteFromStorage(self $privateKey)
|
||||||
{
|
{
|
||||||
|
if ($privateKey->isInUse()) {
|
||||||
|
throw new \Exception('Cannot delete a private key that is in use.');
|
||||||
|
}
|
||||||
|
|
||||||
$filename = "ssh@{$privateKey->uuid}";
|
$filename = "ssh@{$privateKey->uuid}";
|
||||||
Storage::disk('ssh-keys')->delete($filename);
|
Storage::disk('ssh-keys')->delete($filename);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue