mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Skip self-host user-table bootstrap (team backfill, grandfathering) in SaaS
This commit is contained in:
+20
-1
@@ -1,11 +1,13 @@
|
|||||||
package stirling.software.proprietary.security;
|
package stirling.software.proprietary.security;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
@@ -37,6 +39,17 @@ public class InitialSecuritySetup {
|
|||||||
private final ApplicationProperties applicationProperties;
|
private final ApplicationProperties applicationProperties;
|
||||||
private final DatabaseServiceInterface databaseService;
|
private final DatabaseServiceInterface databaseService;
|
||||||
private final UserLicenseSettingsService licenseSettingsService;
|
private final UserLicenseSettingsService licenseSettingsService;
|
||||||
|
private final Environment environment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SaaS manages identity in Supabase and billing via PAYG, so the self-host bootstrap steps that
|
||||||
|
* scan/rewrite the whole user table (default-team backfill, seat-license grandfathering) don't
|
||||||
|
* apply - and against a large SaaS user table they stall startup with full-table loads +
|
||||||
|
* per-row saveAll. Per-user team assignment happens in SupabaseAuthenticationFilter instead.
|
||||||
|
*/
|
||||||
|
private boolean isSaas() {
|
||||||
|
return Arrays.asList(environment.getActiveProfiles()).contains("saas");
|
||||||
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
@@ -51,9 +64,15 @@ public class InitialSecuritySetup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configureJWTSettings();
|
configureJWTSettings();
|
||||||
assignUsersToDefaultTeamIfMissing();
|
|
||||||
initializeInternalApiUser();
|
initializeInternalApiUser();
|
||||||
|
if (isSaas()) {
|
||||||
|
log.info(
|
||||||
|
"SaaS profile active - skipping self-host user-table bootstrap"
|
||||||
|
+ " (default-team backfill, seat-license grandfathering).");
|
||||||
|
} else {
|
||||||
|
assignUsersToDefaultTeamIfMissing();
|
||||||
initializeUserLicenseSettings();
|
initializeUserLicenseSettings();
|
||||||
|
}
|
||||||
} catch (IllegalArgumentException | SQLException | UnsupportedProviderException e) {
|
} catch (IllegalArgumentException | SQLException | UnsupportedProviderException e) {
|
||||||
log.error("Failed to initialize security setup.", e);
|
log.error("Failed to initialize security setup.", e);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user