Loheide-eu-mitarbeiterplatt.../app/Filament/Resources/IdentityProviders/Pages/EditIdentityProvider.php
Friederich Loheide 6269d3302c
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
Beliebige Entra-Attribute ins Profil übernehmen; eigene Profilfelder
- 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>
2026-09-26 08:09:57 +00:00

63 lines
2.4 KiB
PHP

<?php
namespace App\Filament\Resources\IdentityProviders\Pages;
use App\Filament\Resources\IdentityProviders\IdentityProviderResource;
use App\Support\Audit;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Icons\Heroicon;
class EditIdentityProvider extends EditRecord
{
protected static string $resource = IdentityProviderResource::class;
/**
* Das Geheimnis nie ins Formular (und damit in den Browser) schreiben.
*/
protected function mutateFormDataBeforeFill(array $data): array
{
$data['config']['client_secret'] = null;
// Ältere Konfiguration (feste Feldliste) als Zuordnung anzeigen.
if (! is_array($data['config']['attribute_map'] ?? null)) {
$data['config']['attribute_map'] = collect($this->record->attributeMap())
->map(fn ($attribute, $target) => ['target' => $target, 'attribute' => $attribute])->values()->all();
$data['config']['sync_manager'] = $this->record->syncsManager();
}
return $data;
}
/**
* Leeres Geheimnis = gespeichertes behalten.
*/
protected function mutateFormDataBeforeSave(array $data): array
{
if (blank($data['config']['client_secret'] ?? null)) {
$data['config']['client_secret'] = $this->record->setting('client_secret');
}
// Geladene Erweiterungen liegen nur in der Datenbank, nicht im Formular.
$data['config']['extension_properties'] = $this->record->fresh()?->setting('extension_properties', []) ?? [];
$data['config']['attribute_map'] = array_values((array) ($data['config']['attribute_map'] ?? []));
unset($data['config']['synced_fields']);
return $data;
}
protected function afterSave(): void
{
Audit::log('identity.provider_updated', ['provider' => $this->record->name, 'enabled' => $this->record->enabled]);
}
protected function getHeaderActions(): array
{
return [
Action::make('test')->label('Mapping testen')->icon(Heroicon::OutlinedBeaker)->color('gray')
->url(fn () => IdentityProviderResource::getUrl('test', ['record' => $this->record])),
DeleteAction::make()->modalDescription('Verknüpfungen und Rollen aus Entra-Gruppen werden entfernt. Die Konten selbst bleiben bestehen.'),
];
}
}