Zeige im Katalog, wie Inhalte, Pakete und Rechte zusammenhängen.
Deploy Test / test (push) Successful in 13s
Deploy Test / deploy (push) Successful in 23s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-15 10:03:19 +01:00
1 parent fa706e5080
commit cd79fb99d7
22 files changed
+1066 -200

No files matched your search

@@ -10,6 +10,7 @@
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Contracts\Support\Htmlable;
class ListRightsProfiles extends ListRecords
{
@@ -17,6 +18,11 @@ class ListRightsProfiles extends ListRecords
protected static string $resource = RightsProfileResource::class;
public function getSubheading(): string|Htmlable|null
{
return 'Ein Rechteprofil beschreibt den Zweck und die erlaubten Handlungen. Es wird nicht verkauft; ein Angebot verbindet es mit Artikeln.';
}
protected function getHeaderActions(): array
{
return [
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\RightsProfiles\Pages;
use App\Filament\Resources\RightsProfiles\RightsProfileResource;
use Filament\Resources\Pages\ViewRecord;
class ViewRightsProfile extends ViewRecord
{
protected static string $resource = RightsProfileResource::class;
}
@@ -5,10 +5,16 @@
use App\Domain\Catalog\RightsProfile;
use App\Filament\Resources\LicenseArticles\LicenseArticleResource;
use App\Filament\Resources\RightsProfiles\Pages\ListRightsProfiles;
use App\Filament\Resources\RightsProfiles\Pages\ViewRightsProfile;
use App\Filament\Support\CatalogReading;
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Resource;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Auth\Access\Response;
use Illuminate\Database\Eloquent\Model;
class RightsProfileResource extends Resource
{
@@ -24,11 +30,28 @@ class RightsProfileResource extends Resource
protected static ?string $recordTitleAttribute = 'name';
protected static ?int $navigationSort = 3;
public static function canViewAny(): bool
{
return LicenseArticleResource::keeper();
}
public static function getViewAuthorizationResponse(Model $record): Response
{
return LicenseArticleResource::keeper() ? Response::allow() : Response::deny();
}
public static function infolist(Schema $schema): Schema
{
return $schema->components([
Section::make('Fähigkeiten')->description('Zweck und erlaubte Handlungen. Angebote verwenden diese Fassung.')->schema([
TextEntry::make('rights')->hiddenLabel()->listWithLineBreaks()
->state(fn (RightsProfile $record): array => app(CatalogReading::class)->rights($record)),
]),
]);
}
public static function form(Schema $schema): Schema
{
return $schema;
@@ -39,13 +62,14 @@ public static function table(Table $table): Table
return $table->columns([
TextColumn::make('name')->label('Name')->searchable(),
TextColumn::make('versions.purpose')->label('Zwecke')->badge(),
])->recordUrl(null);
]);
}
public static function getPages(): array
{
return [
'index' => ListRightsProfiles::route('/'),
'view' => ViewRightsProfile::route('/{record}'),
];
}
}