feat: vendor admin management and shared account settings #59

Merged
hsiegeln merged 19 commits from feature/vendor-admin-account-settings into main 2026-04-27 15:20:23 +02:00
Showing only changes of commit 665ffefd3e - Show all commits

View File

@@ -1,5 +1,6 @@
package net.siegeln.cameleer.saas.onboarding;
import net.siegeln.cameleer.saas.account.AccountService;
import net.siegeln.cameleer.saas.identity.LogtoManagementClient;
import net.siegeln.cameleer.saas.tenant.TenantEntity;
import net.siegeln.cameleer.saas.tenant.dto.CreateTenantRequest;
@@ -8,7 +9,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.UUID;
/**
@@ -23,11 +23,14 @@ public class OnboardingService {
private final VendorTenantService vendorTenantService;
private final LogtoManagementClient logtoClient;
private final AccountService accountService;
public OnboardingService(VendorTenantService vendorTenantService,
LogtoManagementClient logtoClient) {
LogtoManagementClient logtoClient,
AccountService accountService) {
this.vendorTenantService = vendorTenantService;
this.logtoClient = logtoClient;
this.accountService = accountService;
}
public TenantEntity createTrialTenant(String name, String slug, String logtoUserId) {
@@ -55,12 +58,12 @@ public class OnboardingService {
log.info("Added user {} as owner of tenant {}", logtoUserId, slug);
// Set display name from email if not already set (email-registered users have no name)
var user = logtoClient.getUser(logtoUserId);
if (user != null && (user.get("name") == null || String.valueOf(user.get("name")).isBlank())) {
String email = String.valueOf(user.getOrDefault("primaryEmail", ""));
var profile = accountService.getProfile(logtoUserId);
if (profile.name() == null || profile.name().isBlank()) {
String email = profile.email();
if (!email.isBlank() && email.contains("@")) {
String displayName = email.substring(0, email.indexOf('@'));
logtoClient.updateUserProfile(logtoUserId, Map.of("name", displayName));
accountService.updateDisplayName(logtoUserId, displayName);
log.info("Set display name '{}' for user {}", displayName, logtoUserId);
}
}