fix same ssh key in different teams

This commit is contained in:
peaklabs-dev
2024-11-14 21:53:38 +01:00
parent 36fd0b17ee
commit a58125cbfe

View File

@@ -218,13 +218,11 @@ class PrivateKey extends BaseModel
private static function fingerprintExists($fingerprint, $excludeId = null)
{
$query = self::where('fingerprint', $fingerprint);
if (! is_null($excludeId)) {
$query->where('id', '!=', $excludeId);
}
return $query->exists();
return self::query()
->where('fingerprint', $fingerprint)
->where('team_id', currentTeam()->id)
->when($excludeId, fn ($query) => $query->where('id', '!=', $excludeId))
->exists();
}
public static function cleanupUnusedKeys()