Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changes for multitenancy dashboard #119

Merged
merged 4 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [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

### 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

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

```sql
-- helper stored procedures
DELIMITER //

CREATE PROCEDURE st_drop_all_fkeys()
BEGIN
Expand Down Expand Up @@ -264,7 +280,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
END LOOP;

CLOSE dropCur;
END
END //

--

Expand Down Expand Up @@ -323,7 +339,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
END LOOP;

CLOSE dropCur;
END
END //

--

Expand Down Expand Up @@ -382,7 +398,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
END LOOP;

CLOSE dropCur;
END
END //

--

Expand Down Expand Up @@ -441,7 +457,7 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
END LOOP;

CLOSE dropCur;
END
END //

--

Expand Down Expand Up @@ -473,8 +489,9 @@ CREATE INDEX app_id_to_user_id_user_id_index ON app_id_to_user_id (user_id);
execute add_column_sql;
SELECT 'Column Successfully Created!' INTO p_status_message;
END IF;
END
END //

DELIMITER ;
-- Drop constraints and indexes

CALL st_drop_all_fkeys();
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java-library'
}

version = "7.0.1"
version = "7.1.0"

repositories {
mavenCentral()
Expand Down
8 changes: 4 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ mysql_config_version: 0
# mysql_port:


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


Expand All @@ -39,7 +39,7 @@ mysql_config_version: 0
# mysql_database_name:

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


Expand Down Expand Up @@ -75,7 +75,7 @@ mysql_config_version: 0

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


# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: 60000) long value. Timeout in milliseconds for the idle connections
Expand Down
19 changes: 12 additions & 7 deletions devConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ mysql_config_version: 0
# mysql_port:


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


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

Expand All @@ -40,7 +40,7 @@ mysql_password: "root"


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


Expand All @@ -53,31 +53,36 @@ mysql_password: "root"
# session info for users.
# mysql_session_info_table_name:


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


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


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


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


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


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

# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: 1) integer value. Minimum number of idle connections to be kept
# (DIFFERENT_ACROSS_TENANTS | OPTIONAL | Default: null) integer value. Minimum number of idle connections to be kept
# active. If not set, minimum idle connections will be same as the connection pool size.
# mysql_minimum_idle_connections:
2 changes: 1 addition & 1 deletion pluginInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_comment": "contains a list of plugin interfaces branch names that this core supports",
"versions": [
"6.1"
"6.2"
]
}
5 changes: 5 additions & 0 deletions src/main/java/io/supertokens/storage/mysql/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -2767,6 +2767,11 @@ public Set<String> getValidFieldsInConfig() {
return MySQLConfig.getValidFields();
}

@Override
public List<ConfigFieldInfo> getPluginConfigFieldsInfo() {
return MySQLConfig.getConfigFieldsInfoForDashboard(this);
}

@Override
public void setLogLevels(Set<LOG_LEVEL> logLevels) {
Config.setLogLevels(this, logLevels);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
* "License") as published by the Apache Software Foundation.
*
* You may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

package io.supertokens.storage.mysql.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Annotation to provide a description for a configuration fields. To be used on the fields of `CoreConfig` and config
* class in the plugin like `PostgreSQLConfig`, `MysqlConfig`, etc.
*/
@Retention(RetentionPolicy.RUNTIME) // Make annotation accessible at runtime so that config descriptions can be read from API
@Target(ElementType.FIELD) // Annotation can only be applied to fields
public @interface DashboardInfo {
String description() default "";
boolean isOptional() default false;
String defaultValue() default "";
boolean isEditable() default false;
}
Loading
Loading