From f73d3ed04c29786083263fa5db5e5ebd64928239 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Tue, 2 Jul 2024 12:28:07 +0530 Subject: [PATCH 1/3] fix: providers non null --- CHANGELOG.md | 7 ++----- .../storage/mysql/queries/MultitenancyQueries.java | 1 - .../queries/multitenancy/TenantConfigSQLHelper.java | 10 ++++------ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb58a3b..80688aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,17 +9,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [7.1.0] - 2024-05-24 -- Adds implementation for a new method `getConfigFieldsInfo` to fetch the plugin config fields. -- Adds `null` state for `firstFactors` and `providers` by adding `is_first_factors_null` and `is_third_party_providers_null` fields in `tenant_configs` table +- Adds implementation for a new method `getConfigFieldsInfo` to fetch the plugin config fields +- Adds `null` state for `firstFactors` by adding `is_first_factors_null` fields in `tenant_configs` table ### Migration ```sql ALTER TABLE tenant_configs ADD COLUMN is_first_factors_null BOOLEAN DEFAULT TRUE; -ALTER TABLE tenant_configs ADD COLUMN is_third_party_providers_null BOOLEAN DEFAULT TRUE; - ALTER TABLE tenant_configs ALTER COLUMN is_first_factors_null DROP DEFAULT; -ALTER TABLE tenant_configs ALTER COLUMN is_third_party_providers_null DROP DEFAULT; ``` ## [7.0.1] - 2024-04-17 diff --git a/src/main/java/io/supertokens/storage/mysql/queries/MultitenancyQueries.java b/src/main/java/io/supertokens/storage/mysql/queries/MultitenancyQueries.java index ca8ead2..9761ad2 100644 --- a/src/main/java/io/supertokens/storage/mysql/queries/MultitenancyQueries.java +++ b/src/main/java/io/supertokens/storage/mysql/queries/MultitenancyQueries.java @@ -56,7 +56,6 @@ static String getQueryToCreateTenantConfigsTable(Start start) { + "passwordless_enabled BOOLEAN," + "third_party_enabled BOOLEAN," + "is_first_factors_null BOOLEAN," - + "is_third_party_providers_null BOOLEAN," + "PRIMARY KEY (connection_uri_domain, app_id, tenant_id)" + ");"; // @formatter:on diff --git a/src/main/java/io/supertokens/storage/mysql/queries/multitenancy/TenantConfigSQLHelper.java b/src/main/java/io/supertokens/storage/mysql/queries/multitenancy/TenantConfigSQLHelper.java index 33c6899..7501a98 100644 --- a/src/main/java/io/supertokens/storage/mysql/queries/multitenancy/TenantConfigSQLHelper.java +++ b/src/main/java/io/supertokens/storage/mysql/queries/multitenancy/TenantConfigSQLHelper.java @@ -54,13 +54,12 @@ public static TenantConfigRowMapper getInstance(ThirdPartyConfig.Provider[] prov public TenantConfig map(ResultSet result) throws StorageQueryException { try { boolean isFirstFactorsNull = result.getBoolean("is_first_factors_null"); - boolean isThirdPartyProvidersNull = result.getBoolean("is_third_party_providers_null"); return new TenantConfig( new TenantIdentifier(result.getString("connection_uri_domain"), result.getString("app_id"), result.getString("tenant_id")), new EmailPasswordConfig(result.getBoolean("email_password_enabled")), new ThirdPartyConfig(result.getBoolean( "third_party_enabled"), - providers.length == 0 && isThirdPartyProvidersNull ? null : providers), + providers), new PasswordlessConfig(result.getBoolean("passwordless_enabled")), firstFactors.length == 0 && isFirstFactorsNull ? null : firstFactors, requiredSecondaryFactors.length == 0 ? null : requiredSecondaryFactors, @@ -76,7 +75,7 @@ public static TenantConfig[] selectAll(Start start, HashMap {}, result -> { @@ -109,8 +108,8 @@ public static void create(Start start, Connection sqlCon, TenantConfig tenantCon String QUERY = "INSERT INTO " + getConfig(start).getTenantConfigsTable() + "(connection_uri_domain, app_id, tenant_id, core_config," + " email_password_enabled, passwordless_enabled, third_party_enabled," - + " is_first_factors_null, is_third_party_providers_null)" - + " VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"; + + " is_first_factors_null)" + + " VALUES(?, ?, ?, ?, ?, ?, ?, ?)"; try { update(sqlCon, QUERY, pst -> { @@ -122,7 +121,6 @@ public static void create(Start start, Connection sqlCon, TenantConfig tenantCon pst.setBoolean(6, tenantConfig.passwordlessConfig.enabled); pst.setBoolean(7, tenantConfig.thirdPartyConfig.enabled); pst.setBoolean(8, tenantConfig.firstFactors == null); - pst.setBoolean(9, tenantConfig.thirdPartyConfig.providers == null); }); } catch (StorageQueryException e) { throw new StorageTransactionLogicException(e); From 23d03afbe4aa4febf8ba60868905879e5a26220f Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Tue, 9 Jul 2024 12:26:13 +0530 Subject: [PATCH 2/3] fix: build and changelog --- CHANGELOG.md | 9 +++++++-- .../mysql/test/multitenancy/StorageLayerTest.java | 12 ++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53058ee..ae185b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [7.1.0] - 2024-05-24 -- Adds implementation for a new method `getConfigFieldsInfo` to fetch the plugin config fields -- Adds `null` state for `firstFactors` by adding `is_first_factors_null` fields in `tenant_configs` table +- Compatible with plugin interface version 6.2 +- Adds implementation for a new method `getConfigFieldsInfo` to fetch the plugin config fields. +- Adds `null` state for `firstFactors` and `providers` by adding `is_first_factors_null` + and `is_third_party_providers_null` fields in `tenant_configs` table +- Adds `DashboardInfo` annotations to the config properties in `PostgreSQLConfig` +- Adds `null` state for `firstFactors` by adding `is_first_factors_null` field in `tenant_configs` table. The value of + this column is only applicable when there are no entries in the `tenant_first_factors` table for the tenant. ### Migration diff --git a/src/test/java/io/supertokens/storage/mysql/test/multitenancy/StorageLayerTest.java b/src/test/java/io/supertokens/storage/mysql/test/multitenancy/StorageLayerTest.java index 3934d4f..4d7496a 100644 --- a/src/test/java/io/supertokens/storage/mysql/test/multitenancy/StorageLayerTest.java +++ b/src/test/java/io/supertokens/storage/mysql/test/multitenancy/StorageLayerTest.java @@ -168,11 +168,11 @@ public void storageInstanceIsReusedAcrossTenants() StorageLayer.getStorage(new TenantIdentifier(null, null, null), process.getProcess())); Assert.assertEquals( - Config.getConfig(new TenantIdentifier(null, null, null), process.getProcess()).getAccessTokenValidity(), + Config.getConfig(new TenantIdentifier(null, null, null), process.getProcess()).getAccessTokenValidityInMillis(), (long) 3600 * 1000); Assert.assertEquals(Config.getConfig(new TenantIdentifier(null, "abc", null), process.getProcess()) - .getAccessTokenValidity(), + .getAccessTokenValidityInMillis(), (long) 3601 * 1000); Assert.assertEquals( @@ -232,11 +232,11 @@ public void storageInstanceIsReusedAcrossTenantsComplex() StorageLayer.getStorage(new TenantIdentifier(null, null, null), process.getProcess())); Assert.assertEquals( - Config.getConfig(new TenantIdentifier(null, null, null), process.getProcess()).getAccessTokenValidity(), + Config.getConfig(new TenantIdentifier(null, null, null), process.getProcess()).getAccessTokenValidityInMillis(), (long) 3600 * 1000); Assert.assertEquals(Config.getConfig(new TenantIdentifier(null, "abc", null), process.getProcess()) - .getAccessTokenValidity(), + .getAccessTokenValidityInMillis(), (long) 3601 * 1000); Assert.assertEquals( @@ -441,11 +441,11 @@ public void newStorageIsNotCreatedWhenSameTenantIsAdded() existingStorage); Assert.assertEquals( - Config.getConfig(new TenantIdentifier(null, null, null), process.getProcess()).getAccessTokenValidity(), + Config.getConfig(new TenantIdentifier(null, null, null), process.getProcess()).getAccessTokenValidityInMillis(), (long) 3600 * 1000); Assert.assertEquals(Config.getConfig(new TenantIdentifier(null, "abc", null), process.getProcess()) - .getAccessTokenValidity(), + .getAccessTokenValidityInMillis(), (long) 3601 * 1000); Assert.assertEquals( From af54cdd6fb8b2ac715ad4f55fffa2053cafacefa Mon Sep 17 00:00:00 2001 From: rishabhpoddar Date: Sun, 28 Jul 2024 22:29:17 +0530 Subject: [PATCH 3/3] changes version --- CHANGELOG.md | 15 +++++++++++++-- build.gradle | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae185b0..3a690b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,20 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [7.1.1] - 2024-06-29 + +- Fixes issue where `is_third_party_providers_null` is added to the `tenant_configs` table. + +### Migration + +```sql +ALTER TABLE tenant_configs DROP COLUMN is_third_party_providers_null; +``` + ## [7.1.0] - 2024-05-24 - Compatible with plugin interface version 6.2 - Adds implementation for a new method `getConfigFieldsInfo` to fetch the plugin config fields. -- Adds `null` state for `firstFactors` and `providers` by adding `is_first_factors_null` - and `is_third_party_providers_null` fields in `tenant_configs` table - Adds `DashboardInfo` annotations to the config properties in `PostgreSQLConfig` - Adds `null` state for `firstFactors` by adding `is_first_factors_null` field in `tenant_configs` table. The value of this column is only applicable when there are no entries in the `tenant_first_factors` table for the tenant. @@ -21,7 +29,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ```sql ALTER TABLE tenant_configs ADD COLUMN is_first_factors_null BOOLEAN DEFAULT TRUE; +ALTER TABLE tenant_configs ADD COLUMN is_third_party_providers_null BOOLEAN DEFAULT TRUE; + ALTER TABLE tenant_configs ALTER COLUMN is_first_factors_null DROP DEFAULT; +ALTER TABLE tenant_configs ALTER COLUMN is_third_party_providers_null DROP DEFAULT; ``` ## [7.0.1] - 2024-04-17 diff --git a/build.gradle b/build.gradle index 3776b0c..af9bc2f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-library' } -version = "7.1.0" +version = "7.1.1" repositories { mavenCentral()