feat(auth): sync display name and job title from Microsoft Graph, fix tenant SSO form handling

Fetches displayName/jobTitle from Graph API and syncs them via SSO profile sync. Also fixes LDAP enabled state in tenant form, adds LDAP save on tenant create, and hardens LDAP port validation precedence.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-13 14:13:21 +02:00
parent 312d43d9d9
commit 4e359fe659
9 changed files with 39 additions and 10 deletions

View File

@@ -225,13 +225,13 @@ class UserWriteRepository implements UserWriteRepositoryInterface
return false;
}
$row = DB::selectOne('select first_name, last_name, email, phone, mobile from users where id = ? limit 1', (string) $id);
$row = DB::selectOne('select first_name, last_name, email, phone, mobile, job_title, display_name from users where id = ? limit 1', (string) $id);
$existing = $row['users'] ?? null;
if (!is_array($existing)) {
return false;
}
$allowed = ['first_name', 'last_name', 'phone', 'mobile'];
$allowed = ['first_name', 'last_name', 'display_name', 'job_title', 'phone', 'mobile'];
$updates = [];
foreach ($allowed as $field) {
if (!array_key_exists($field, $fields)) {
@@ -251,7 +251,7 @@ class UserWriteRepository implements UserWriteRepositoryInterface
return true;
}
if (isset($updates['first_name']) || isset($updates['last_name'])) {
if (!isset($updates['display_name']) && (isset($updates['first_name']) || isset($updates['last_name']))) {
$displayData = [
'first_name' => $updates['first_name'] ?? (string) ($existing['first_name'] ?? ''),
'last_name' => $updates['last_name'] ?? (string) ($existing['last_name'] ?? ''),