Loheide-eu-mitarbeiterplatt.../app/Filament/Resources/ProfileFields/Pages/ManageProfileFields.php
Friederich Loheide f1202bea08
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m50s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m34s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m45s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m30s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m9s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m8s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m5s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 48s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m5s
Sicherheitsupdate nach Audit (0.29.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 11:34:54 +00:00

38 lines
1.8 KiB
PHP

<?php
namespace App\Filament\Resources\ProfileFields\Pages;
use App\Filament\Resources\ProfileFields\ProfileFieldResource;
use App\Support\Audit;
use App\Support\ProfileFields;
use App\Support\Settings;
use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Forms\Components\Toggle;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ManageRecords;
use Filament\Support\Icons\Heroicon;
class ManageProfileFields extends ManageRecords
{
protected static string $resource = ProfileFieldResource::class;
protected function getHeaderActions(): array
{
return [
Action::make('settings')->label('Selbst pflegen')->icon(Heroicon::OutlinedCog6Tooth)->color('gray')
->modalHeading('Was Mitarbeitende selbst ändern dürfen')
->fillForm(fn () => ['self_edit_org' => (bool) app(Settings::class)->get(ProfileFields::SELF_EDIT_ORG, false)])
->schema([
Toggle::make('self_edit_org')->label('Abteilung und Standort selbst ändern')
->helperText('Vorsicht: Abteilung und Standort bestimmen, wer welche Inhalte sieht (Zielgruppen). Wer sie selbst ändern darf, kann sich so Zugang zu Inhalten anderer Abteilungen verschaffen. Die E-Mail-Adresse ändert immer die Administration unter „Benutzer“.'),
])
->action(function (array $data) {
app(Settings::class)->set(ProfileFields::SELF_EDIT_ORG, (bool) $data['self_edit_org']);
Audit::log('profile.self_edit_org', ['enabled' => (bool) $data['self_edit_org']]);
Notification::make()->success()->title('Gespeichert')->send();
}),
CreateAction::make()->label('Profilfeld anlegen'),
];
}
}