Skip to content

Commit 34f5075

Browse files
authored
feat: changes for multitenancy dashboard (#119)
* fix: changes for multitenancy dashboard * fix: changelog * fix: impl
1 parent de70b57 commit 34f5075

File tree

11 files changed

+397
-73
lines changed

11 files changed

+397
-73
lines changed

CHANGELOG.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [7.1.0] - 2024-05-24
11+
12+
- Adds implementation for a new method `getConfigFieldsInfo` to fetch the plugin config fields.
13+
- Adds `null` state for `firstFactors` and `providers` by adding `is_first_factors_null` and `is_third_party_providers_null` fields in `tenant_configs` table
14+
15+
### Migration
16+
17+
```sql
18+
ALTER TABLE tenant_configs ADD COLUMN is_first_factors_null BOOLEAN DEFAULT TRUE;
19+
ALTER TABLE tenant_configs ADD COLUMN is_third_party_providers_null BOOLEAN DEFAULT TRUE;
20+
21+
ALTER TABLE tenant_configs ALTER COLUMN is_first_factors_null DROP DEFAULT;
22+
ALTER TABLE tenant_configs ALTER COLUMN is_third_party_providers_null DROP DEFAULT;
23+
```
24+
1025
## [7.0.1] - 2024-04-17
1126

1227
- Fixes issues with partial failures during tenant creation
@@ -208,6 +223,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
208223

209224
```sql
210225
-- helper stored procedures
226+
DELIMITER //
211227

212228
CREATE PROCEDURE st_drop_all_fkeys()
213229
BEGIN
@@ -264,7 +280,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
264280
END LOOP;
265281

266282
CLOSE dropCur;
267-
END
283+
END //
268284

269285
--
270286

@@ -323,7 +339,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
323339
END LOOP;
324340

325341
CLOSE dropCur;
326-
END
342+
END //
327343

328344
--
329345

@@ -382,7 +398,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
382398
END LOOP;
383399

384400
CLOSE dropCur;
385-
END
401+
END //
386402

387403
--
388404

@@ -441,7 +457,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
441457
END LOOP;
442458

443459
CLOSE dropCur;
444-
END
460+
END //
445461

446462
--
447463

@@ -473,8 +489,9 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
473489
execute add_column_sql;
474490
SELECT 'Column Successfully Created!' INTO p_status_message;
475491
END IF;
476-
END
492+
END //
477493

494+
DELIMITER ;
478495
-- Drop constraints and indexes
479496

480497
CALL st_drop_all_fkeys();

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id 'java-library'
33
}
44

5-
version = "7.0.1"
5+
version = "7.1.0"
66

77
repositories {
88
mavenCentral()

config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ mysql_config_version: 0
2424
# mysql_port:
2525

2626

27-
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: root) string value. The MySQL user to use to query the database.
27+
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "root") string value. The MySQL user to use to query the database.
2828
# If the relevant tables are not already created by you, this user should have the
29-
# ability to create new tables. To see the tables needed, visit: https://supertokens.io/docs/community/getting-started/database-setup/mysql
29+
# ability to create new tables. To see the tables needed, visit: https://supertokens.com/docs/thirdpartyemailpassword/pre-built-ui/setup/database-setup/mysql
3030
# mysql_user:
3131

3232

@@ -39,7 +39,7 @@ mysql_config_version: 0
3939
# mysql_database_name:
4040

4141
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "") string value. A prefix to add to all table names managed by SuperTokens. An "_" will be
42-
# added between this prefix and the actual table name if the prefix is defined
42+
# added between this prefix and the actual table name if the prefix is defined.
4343
# mysql_table_names_prefix:
4444

4545

@@ -75,7 +75,7 @@ mysql_config_version: 0
7575

7676
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "thirdparty_users") string value. Specify the name of the table that will
7777
# store the thirdparty recipe users.
78-
# mysql_thirdparty_users_table_name
78+
# mysql_thirdparty_users_table_name:
7979

8080

8181
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: 60000) long value. Timeout in milliseconds for the idle connections

devConfig.yaml

+12-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ mysql_config_version: 0
2424
# mysql_port:
2525

2626

27-
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: root) string value. The MySQL user to use to query the database.
28-
# If the relevant tables are not already created by you, this user should have the
29-
# ability to create new tables. To see the tables needed, visit: TODO
27+
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "root") string value. The MySQL user to use to query the database.
28+
# If the relevant tables are not already created by you, this user should have the
29+
# ability to create new tables. To see the tables needed, visit: https://supertokens.com/docs/thirdpartyemailpassword/pre-built-ui/setup/database-setup/mysql
3030
mysql_user: "root"
3131

3232

33-
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: no password) string value. Password for the MySQL instance. If you do not have a password
33+
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: no password) string value. Password for the MySQL user. If you have not set a password
3434
# make this an empty string.
3535
mysql_password: "root"
3636

@@ -40,7 +40,7 @@ mysql_password: "root"
4040

4141

4242
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "") string value. A prefix to add to all table names managed by SuperTokens. An "_" will be
43-
# added between this prefix and the actual table name if the prefix is defined
43+
# added between this prefix and the actual table name if the prefix is defined.
4444
# mysql_table_names_prefix:
4545

4646

@@ -53,31 +53,36 @@ mysql_password: "root"
5353
# session info for users.
5454
# mysql_session_info_table_name:
5555

56+
5657
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "emailpassword_users") string value. Specify the name of the table that will store the
5758
# user information, along with their email and hashed password.
5859
# mysql_emailpassword_users_table_name:
5960

61+
6062
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "emailpassword_pswd_reset_tokens") string value. Specify the name of the table that will
6163
# store the password reset tokens for users.
6264
# mysql_emailpassword_pswd_reset_tokens_table_name:
6365

66+
6467
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "emailverification_tokens") string value. Specify the name of the table that will
6568
# store the email verification tokens for users.
6669
# mysql_emailverification_tokens_table_name:
6770

71+
6872
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "emailverification_verified_emails") string value. Specify the name of the table that will
6973
# store the verified email addresses.
7074
# mysql_emailverification_verified_emails_table_name:
7175

76+
7277
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: "thirdparty_users") string value. Specify the name of the table that will
7378
# store the thirdparty recipe users.
74-
# mysql_thirdparty_users_table_name
79+
# mysql_thirdparty_users_table_name:
7580

7681

7782
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: 60000) long value. Timeout in milliseconds for the idle connections
7883
# to be closed.
7984
# mysql_idle_connection_timeout:
8085

81-
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: 1) integer value. Minimum number of idle connections to be kept
86+
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: null) integer value. Minimum number of idle connections to be kept
8287
# active. If not set, minimum idle connections will be same as the connection pool size.
8388
# mysql_minimum_idle_connections:

pluginInterfaceSupported.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_comment": "contains a list of plugin interfaces branch names that this core supports",
33
"versions": [
4-
"6.1"
4+
"6.2"
55
]
66
}

src/main/java/io/supertokens/storage/mysql/Start.java

+5
Original file line numberDiff line numberDiff line change
@@ -2767,6 +2767,11 @@ public Set<String> getValidFieldsInConfig() {
27672767
return MySQLConfig.getValidFields();
27682768
}
27692769

2770+
@Override
2771+
public List<ConfigFieldInfo> getPluginConfigFieldsInfo() {
2772+
return MySQLConfig.getConfigFieldsInfoForDashboard(this);
2773+
}
2774+
27702775
@Override
27712776
public void setLogLevels(Set<LOG_LEVEL> logLevels) {
27722777
Config.setLogLevels(this, logLevels);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.
3+
*
4+
* This software is licensed under the Apache License, Version 2.0 (the
5+
* "License") as published by the Apache Software Foundation.
6+
*
7+
* You may not use this file except in compliance with the License. You may
8+
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
package io.supertokens.storage.mysql.annotations;
18+
19+
import java.lang.annotation.ElementType;
20+
import java.lang.annotation.Retention;
21+
import java.lang.annotation.RetentionPolicy;
22+
import java.lang.annotation.Target;
23+
24+
/**
25+
* Annotation to provide a description for a configuration fields. To be used on the fields of `CoreConfig` and config
26+
* class in the plugin like `PostgreSQLConfig`, `MysqlConfig`, etc.
27+
*/
28+
@Retention(RetentionPolicy.RUNTIME) // Make annotation accessible at runtime so that config descriptions can be read from API
29+
@Target(ElementType.FIELD) // Annotation can only be applied to fields
30+
public @interface DashboardInfo {
31+
String description() default "";
32+
boolean isOptional() default false;
33+
String defaultValue() default "";
34+
boolean isEditable() default false;
35+
}

0 commit comments

Comments
 (0)