From 64cfdd980ad70341a9c0999b3ded939a6aac1f18 Mon Sep 17 00:00:00 2001 From: Damien Coraboeuf Date: Mon, 28 Oct 2024 19:28:41 +0100 Subject: [PATCH] #1235 License key renaming --- .../EmbeddedLicenseConfigurationProperties.kt | 2 +- .../license/embedded/EmbeddedLicenseService.kt | 2 +- .../extension/license/settings/LicenseSettings.kt | 2 +- .../license/settings/LicenseSettingsManager.kt | 4 ++-- .../license/settings/LicenseSettingsProvider.kt | 2 +- .../license/settings/SettingsLicenseService.kt | 2 +- .../license/embedded/SignatureLicenseServiceTest.kt | 4 ++-- .../components/framework/settings/license-form.js | 12 ++---------- 8 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseConfigurationProperties.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseConfigurationProperties.kt index fb37a000be..478fe68977 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseConfigurationProperties.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseConfigurationProperties.kt @@ -6,5 +6,5 @@ import org.springframework.stereotype.Component @ConfigurationProperties(prefix = "ontrack.config.license.embedded") @Component class EmbeddedLicenseConfigurationProperties { - var license: String? = null + var key: String? = null } diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseService.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseService.kt index 0acd5e3757..2a93d8ad9c 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseService.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/embedded/EmbeddedLicenseService.kt @@ -16,5 +16,5 @@ class EmbeddedLicenseService( ) : AbstractSignatureLicenseService() { override val licenseType: String = "Embedded" - override val encodedLicense: String? = embeddedLicenseConfigurationProperties.license + override val encodedLicense: String? = embeddedLicenseConfigurationProperties.key } \ No newline at end of file diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettings.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettings.kt index a802e36585..dba2cc443e 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettings.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettings.kt @@ -1,5 +1,5 @@ package net.nemerosa.ontrack.extension.license.settings data class LicenseSettings( - val license: String, + val key: String, ) diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsManager.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsManager.kt index 318e5be1b8..166d36a069 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsManager.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsManager.kt @@ -27,7 +27,7 @@ class LicenseSettingsManager( ) { override fun doSaveSettings(settings: LicenseSettings) { - settingsRepository.setString(settings::license) + settingsRepository.setString(settings::key) } override fun getId(): String = "license" @@ -37,6 +37,6 @@ class LicenseSettingsManager( @Deprecated("Deprecated in Java") override fun getSettingsForm(settings: LicenseSettings): Form = Form.create() - .memoField(LicenseSettings::license, settings.license) + .memoField(LicenseSettings::key, settings.key) } \ No newline at end of file diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsProvider.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsProvider.kt index d600a72946..8a3c5a8ed2 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsProvider.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/LicenseSettingsProvider.kt @@ -17,7 +17,7 @@ class LicenseSettingsProvider( ) : SettingsProvider { override fun getSettings() = LicenseSettings( - license = settingsRepository.getString(LicenseSettings::license, ""), + key = settingsRepository.getString(LicenseSettings::key, ""), ) override fun getSettingsClass(): Class = LicenseSettings::class.java diff --git a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/SettingsLicenseService.kt b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/SettingsLicenseService.kt index c41f17c0b3..5ac11c13b8 100644 --- a/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/SettingsLicenseService.kt +++ b/ontrack-extension-license/src/main/java/net/nemerosa/ontrack/extension/license/settings/SettingsLicenseService.kt @@ -19,6 +19,6 @@ class SettingsLicenseService( override val licenseType: String = "Settings" override val encodedLicense: String? - get() = cachedSettingsService.getCachedSettings(LicenseSettings::class.java).license + get() = cachedSettingsService.getCachedSettings(LicenseSettings::class.java).key } \ No newline at end of file diff --git a/ontrack-extension-license/src/test/java/net/nemerosa/ontrack/extension/license/embedded/SignatureLicenseServiceTest.kt b/ontrack-extension-license/src/test/java/net/nemerosa/ontrack/extension/license/embedded/SignatureLicenseServiceTest.kt index 6534f88041..db20cae7f1 100644 --- a/ontrack-extension-license/src/test/java/net/nemerosa/ontrack/extension/license/embedded/SignatureLicenseServiceTest.kt +++ b/ontrack-extension-license/src/test/java/net/nemerosa/ontrack/extension/license/embedded/SignatureLicenseServiceTest.kt @@ -17,7 +17,7 @@ class SignatureLicenseServiceTest { fun `No license content provided`() { val service = EmbeddedLicenseService( EmbeddedLicenseConfigurationProperties().apply { - license = null + key = null } ) assertFailsWith { @@ -29,7 +29,7 @@ class SignatureLicenseServiceTest { fun `License OK`() { val service = EmbeddedLicenseService( EmbeddedLicenseConfigurationProperties().apply { - license = + key = "eyJkYXRhIjoiZXlKdVlXMWxJam9pVUhKbGJXbDFiU0lzSW1GemMybG5ibVZsSWpvaVRtVnRaWEp2YzJFaUxDSjJZV3hwWkZWdWRHbHNJanB1ZFd4c0xDSnRZWGhRY205cVpXTjBjeUk2TUN3aVptVmhkSFZ5WlhNaU9sc2laWGgwWlc1emFXOXVMbVZ1ZG1seWIyNXRaVzUwY3lKZGZRPT0iLCJzaWduYXR1cmUiOiJNRVlDSVFEeUxkUFhBL1k0RjdzR0V1V3RUN3laa0gzQnVMMWZ6S0hRV3hnRDJVSm12UUloQU1seXFxblZkdXpPcEx6VVVyV1N5anNqNU1LVE9WYlRSdTFCam9jZXlqRWUifQ==" } ) diff --git a/ontrack-web-core/components/framework/settings/license-form.js b/ontrack-web-core/components/framework/settings/license-form.js index 36534d03e3..806163566e 100644 --- a/ontrack-web-core/components/framework/settings/license-form.js +++ b/ontrack-web-core/components/framework/settings/license-form.js @@ -6,16 +6,8 @@ export default function LicenseForm({id, ...values}) { <> - - -