Merge pull request #4291 from peaklabs-dev/fix-same-ssh-key-other-team

Fix: Ability to use the same ssh key in a different team
This commit is contained in:
Andras Bacsai 2024-11-15 10:55:32 +01:00 committed by GitHub
commit 9d86198c51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -218,13 +218,11 @@ public static function generateFingerprint($privateKey)
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()