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: multitenancy dashboard #121

Merged
merged 5 commits into from
Jul 28, 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
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,23 @@ 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.

### Migration

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.1.0"
version = "7.1.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ 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,
Expand All @@ -82,7 +81,7 @@ public static TenantConfig[] selectAll(Start start,
throws SQLException, StorageQueryException {
String QUERY = "SELECT 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 FROM "
+ " is_first_factors_null FROM "
+ getConfig(start).getTenantConfigsTable() + ";";

TenantConfig[] tenantConfigs = execute(start, QUERY, pst -> {
Expand Down Expand Up @@ -121,8 +120,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 -> {
Expand All @@ -134,7 +133,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);
Expand Down
Loading