diff --git a/LibreNMS/Enum/SecretType.php b/LibreNMS/Enum/SecretType.php index 0aec94297dbcf9e7ada8fb63af5be439eabad56b..ca1f707ecfab1cf8c67bdc570f76cdf1d5b4feec 100644 --- a/LibreNMS/Enum/SecretType.php +++ b/LibreNMS/Enum/SecretType.php @@ -1,4 +1,5 @@ */ public function secretClass(): string { - return match($this) { + return match ($this) { self::Snmp => SnmpSecret::class, self::Ipmi => IpmiSecret::class, }; diff --git a/app/Casts/EncryptedArray.php b/app/Casts/EncryptedArray.php index b8adb7a54469590122383b429af0e87b3d2b371c..3faab0f2dded6b20a1194c2f50c498310028498c 100644 --- a/app/Casts/EncryptedArray.php +++ b/app/Casts/EncryptedArray.php @@ -32,7 +32,7 @@ class EncryptedArray implements CastsAttributes * * @param array $attributes */ - public function set(Model $model, string $key, mixed $value, array $attributes): string|null + public function set(Model $model, string $key, mixed $value, array $attributes): ?string { if (! is_array($value) || empty($value)) { return null; diff --git a/app/Data/DeviceSecretRepository.php b/app/Data/DeviceSecretRepository.php index 07db4d6e55c4eacadb06d3a2b3c819e9d13e9ef4..c64ab9e2b55e57d1b5be110f8959628f7d3c71a2 100644 --- a/app/Data/DeviceSecretRepository.php +++ b/app/Data/DeviceSecretRepository.php @@ -1,4 +1,5 @@ $secretClass * @return T|null */ diff --git a/app/Data/Secrets/IpmiSecret.php b/app/Data/Secrets/IpmiSecret.php index 38af3d3cd8f6aa694a8800dc7d575cca47c50ef4..f1fb92eb8432c7cb98304c80eaf94df30f40da2c 100644 --- a/app/Data/Secrets/IpmiSecret.php +++ b/app/Data/Secrets/IpmiSecret.php @@ -1,4 +1,5 @@ validate([ 'description' => 'required|string|max:255', - 'default' => 'boolean', + 'default' => 'boolean', ]); $secretType = $secret->secret_type; @@ -127,8 +128,8 @@ class SecretController extends Controller $secret->update([ 'description' => $validated['description'], - 'default' => $request->boolean('default'), - 'data' => $data, + 'default' => $request->boolean('default'), + 'data' => $data, ]); $toast->success(__('Secret updated')); diff --git a/database/migrations/2026_04_01_162956_migrate_snmp_secrets.php b/database/migrations/2026_04_01_162956_migrate_snmp_secrets.php index 7568d1ee76119a2ad76609d4f9e8e9d0d7e8a83f..d71372c1b505bfec5e60b3e1792f7985e5a78cc9 100644 --- a/database/migrations/2026_04_01_162956_migrate_snmp_secrets.php +++ b/database/migrations/2026_04_01_162956_migrate_snmp_secrets.php @@ -62,7 +62,7 @@ return new class extends Migration 'cryptoalgo' => $v3['cryptoalgo'] ?? 'AES', ]; $id = DB::table('secrets')->insertGetId([ - 'description' => "Global SNMP v3 User: " . ($v3['authname'] ?? ''), + 'description' => 'Global SNMP v3 User: ' . ($v3['authname'] ?? ''), 'secret_type' => 'snmp', 'default' => true, 'data' => encrypt(json_encode($data)), @@ -98,7 +98,7 @@ return new class extends Migration $secretId = $globalSecrets[$hash]; } else { // Create per-device secret - $description = "SNMP for device " . $device->hostname; + $description = 'SNMP for device ' . $device->hostname; $secretId = DB::table('secrets')->insertGetId([ 'description' => $description, 'secret_type' => 'snmp', @@ -113,7 +113,8 @@ return new class extends Migration ['device_id' => $device->device_id, 'secret_type' => 'snmp'], ['secret_id' => $secretId] ); - } catch (EncryptException) {} + } catch (EncryptException) { + } } }); }