Beliebige Entra-Attribute ins Profil übernehmen; eigene Profilfelder
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m43s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m52s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m49s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m49s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 2m12s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 1m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 57s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m43s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m52s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m49s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m49s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 2m12s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 1m59s
CI / Build-Artefakte aktuell (pull_request) Successful in 57s
- Profilfelder frei definierbar (Typ, Sichtbarkeit, selbst pflegbar), Werte als JSON am Benutzer - Attribut-Zuordnung je Anbieter statt fester Feldliste: jedes Graph-Attribut inkl. verschachtelter Pfade, onPremisesExtensionAttributes und Verzeichniserweiterungen - Erweiterungsattribute per Knopf aus Entra laden - $select dynamisch aus der Zuordnung; Delta-Abgleich startet bei geänderter Zuordnung neu - Rückfall auf Grundattribute, wenn einzelne Attribute nicht lesbar sind - Ältere Konfiguration (synced_fields) wird weiter gelesen Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
51c94cd0cf
commit
6269d3302c
79 changed files with 1442 additions and 273 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Identity\Entra\EntraAttributes;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
|
@ -12,7 +13,9 @@ use Illuminate\Support\Str;
|
|||
*
|
||||
* config (verschlüsselt): tenant_id, client_id, client_secret, button_label,
|
||||
* auto_provision, link_by_email, allowed_domains, default_role_id,
|
||||
* synced_fields, sync_photo, directory_sync, directory_create_users
|
||||
* attribute_map (Liste aus target + attribute), sync_manager, sync_photo,
|
||||
* extension_properties, directory_sync, directory_create_users
|
||||
* (älter: synced_fields – wird noch gelesen, siehe attributeMap())
|
||||
*/
|
||||
#[Fillable(['type', 'name', 'slug', 'enabled', 'config'])]
|
||||
class IdentityProvider extends Model
|
||||
|
|
@ -20,7 +23,8 @@ class IdentityProvider extends Model
|
|||
public const ENTRA = 'entra';
|
||||
|
||||
/** Profilfelder, die aus dem Identity Provider übernommen werden können. */
|
||||
public const SYNCABLE_FIELDS = [
|
||||
/** Kernfelder des Profils, die aus einem Attribut befüllt werden können. */
|
||||
public const PROFILE_TARGETS = [
|
||||
'first_name' => 'Vorname',
|
||||
'last_name' => 'Nachname',
|
||||
'email' => 'E-Mail-Adresse',
|
||||
|
|
@ -29,7 +33,6 @@ class IdentityProvider extends Model
|
|||
'location' => 'Standort',
|
||||
'phone' => 'Telefon',
|
||||
'mobile' => 'Mobil',
|
||||
'manager' => 'Vorgesetzte*r',
|
||||
];
|
||||
|
||||
protected static function booted(): void
|
||||
|
|
@ -53,11 +56,50 @@ class IdentityProvider extends Model
|
|||
}
|
||||
|
||||
/**
|
||||
* Zuordnung Profilfeld => Graph-Attribut. Ziele sind Kernfelder („job_title“)
|
||||
* oder freie Profilfelder („custom.personalnummer“). Ohne gespeicherte Zuordnung
|
||||
* gilt die Standardzuordnung für die früher gewählten Felder.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function attributeMap(): array
|
||||
{
|
||||
$rows = $this->setting('attribute_map');
|
||||
|
||||
if (! is_array($rows)) {
|
||||
$legacy = (array) $this->setting('synced_fields', array_keys(EntraAttributes::DEFAULT_MAP));
|
||||
|
||||
return array_intersect_key(EntraAttributes::DEFAULT_MAP, array_flip($legacy));
|
||||
}
|
||||
|
||||
$map = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$target = (string) ($row['target'] ?? '');
|
||||
$attribute = trim((string) ($row['attribute'] ?? ''));
|
||||
|
||||
if ($attribute !== '' && preg_match(EntraAttributes::PATH_PATTERN, $attribute)
|
||||
&& (array_key_exists($target, self::PROFILE_TARGETS) || str_starts_with($target, 'custom.'))) {
|
||||
$map[$target] = $attribute;
|
||||
}
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
public function syncsManager(): bool
|
||||
{
|
||||
return (bool) $this->setting('sync_manager', in_array('manager', (array) $this->setting('synced_fields', ['manager']), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Felder, die dieser Anbieter pflegt (im Portal schreibgeschützt).
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function syncedFields(): array
|
||||
{
|
||||
return array_values(array_intersect((array) $this->setting('synced_fields', []), array_keys(self::SYNCABLE_FIELDS)));
|
||||
return [...array_keys($this->attributeMap()), ...($this->syncsManager() ? ['manager'] : [])];
|
||||
}
|
||||
|
||||
public function buttonLabel(): string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue