Fix: Make sure in use private keys are not deleted
This commit is contained in:
@@ -144,6 +144,10 @@ class PrivateKey extends BaseModel
|
||||
|
||||
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}";
|
||||
Storage::disk('ssh-keys')->delete($filename);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user