Phase 4: Seiten mit Pagebuilder, Redaktion und Freigaben
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m56s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m56s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m2s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m9s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m40s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 2m35s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m29s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m38s
CI / Build-Artefakte aktuell (pull_request) Successful in 55s

- Seiten-Plugin: Seitenbaum mit Adressen, Seitennavigation, Brotkrumen und
  optional Hauptnavigation; Sichtbarkeit vererbt sich auf Unterseiten
- Pagebuilder (Block-Registry im Kern, Plugins tragen Blöcke bei): Abschnitt,
  Spalten, Tabs, Akkordeon, Box, Überschrift, Text (TipTap), Zitat,
  Schaltflächen, Symbolliste, Tabelle, Trennlinie, Abstand, Bild, Galerie,
  Video (erst nach Klick), Titelbild, Ansprechpartner, Downloads, Unterseiten,
  Neuigkeiten, Termine; Sichtbarkeit je Block; Bereinigung beim Speichern
- Editor im Portal: Ziehen und Ablegen, Autospeichern als Entwurf,
  Rückgängig, Gerätevorschau, Versionen, Zeitsteuerung, Bearbeitungssperre,
  Freigabe anfordern
- Rechte „inkl. Unterseiten“ werden im Rechte-Cache aufgelöst
- Neuigkeiten: Schreiben im Portal, Freigabe-Workflow mit Benachrichtigungen
- Bereich „Redaktion“, Benachrichtigungen im Portal
- storage/.migrations-fingerprint nicht mehr ausliefern

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 08:52:19 +00:00
parent 6269d3302c
commit f3987e8386
328 changed files with 10618 additions and 389 deletions

View file

@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\Model;
*/
class RoleGrantSelect
{
public static function make(string $name, string $label, string $ability, string $resourceType): Select
public static function make(string $name, string $label, string $ability, string $resourceType, bool $includeChildren = false): Select
{
return Select::make($name)
->label($label)
@ -23,14 +23,14 @@ class RoleGrantSelect
->afterStateHydrated(fn (Select $component, ?Model $record) => $component->state($record
? Grant::query()->where('ability', $ability)->where('resource_type', $resourceType)->where('resource_id', $record->getKey())->pluck('role_id')->all()
: []))
->saveRelationshipsUsing(function (Model $record, ?array $state) use ($ability, $resourceType) {
->saveRelationshipsUsing(function (Model $record, ?array $state) use ($ability, $resourceType, $includeChildren) {
$roleIds = array_map('intval', $state ?? []);
$existing = Grant::query()->where('ability', $ability)->where('resource_type', $resourceType)->where('resource_id', $record->getKey());
(clone $existing)->whereNotIn('role_id', $roleIds)->get()->each->delete();
foreach (array_diff($roleIds, (clone $existing)->pluck('role_id')->all()) as $roleId) {
Grant::query()->create(['role_id' => $roleId, 'ability' => $ability, 'resource_type' => $resourceType, 'resource_id' => $record->getKey()]);
Grant::query()->create(['role_id' => $roleId, 'ability' => $ability, 'resource_type' => $resourceType, 'resource_id' => $record->getKey(), 'include_children' => $includeChildren]);
}
})
->dehydrated(false);

View file

@ -18,6 +18,7 @@ use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Resources\Resource;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
@ -89,7 +90,7 @@ class RoleResource extends Resource
->schema([
Repeater::make('object_grants')
->hiddenLabel()
->columns(2)
->columns(3)
->addActionLabel('Recht hinzufügen')
->defaultItems(0)
->schema([
@ -111,13 +112,19 @@ class RoleResource extends Resource
return ['*' => 'Alle'] + $options;
}),
Toggle::make('include_children')
->label('Inkl. Unterseiten')
->inline(false)
->default(true)
->visible(fn (Get $get) => $abilities->isHierarchical($abilities->all()[$get('ability')]['resource'] ?? null)),
])
->afterStateHydrated(fn (Repeater $component, ?Role $record) => $component->state(
$record?->grants()->whereNotNull('resource_type')->get()
->groupBy('ability')
->map(fn ($grants, $ability) => [
'ability' => $ability,
->groupBy(fn (Grant $g) => $g->ability.'|'.(int) $g->include_children)
->map(fn ($grants) => [
'ability' => $grants->first()->ability,
'resource_ids' => $grants->map(fn (Grant $g) => $g->resource_id === null ? '*' : (string) $g->resource_id)->values()->all(),
'include_children' => (bool) $grants->first()->include_children,
])->values()->all() ?? []
))
->saveRelationshipsUsing(function (Role $record, ?array $state) use ($abilities) {
@ -132,8 +139,10 @@ class RoleResource extends Resource
$ids = in_array('*', (array) $item['resource_ids'], true) ? [null] : array_map('intval', (array) $item['resource_ids']);
$inherit = $abilities->isHierarchical($type) && ($item['include_children'] ?? false);
foreach (array_unique($ids) as $id) {
$record->grants()->create(['ability' => $item['ability'], 'resource_type' => $type, 'resource_id' => $id]);
$record->grants()->create(['ability' => $item['ability'], 'resource_type' => $type, 'resource_id' => $id, 'include_children' => $inherit && $id !== null]);
}
}
})