- users:manage/roles:manage auf allen User-/Rollen-Masken erzwungen; is_super_admin aus $fillable entfernt und nur per autorisiertem forceFill setzbar; zentraler Gate::before-Super-Admin-Kurzschluss (K1/M8). - Nicht-Super-Admins können Super-Admin-Konten nicht mehr bearbeiten (Fix#2); Impersonation mit Rangprüfung, keine Token-Erstellung während Impersonation (H1). - Destruktive/verwaltende Admin-Aktionen (CRM/Billing/Compliance/Struktur) hängen an neuen admin-only Permissions; Editor behält reine Content-Rechte (H2). - Kanonischer Permission-Katalog (App\Authorization\Permission) als Single Source of Truth für Seeder und Monitoring. Deployment: `php artisan db:seed --class=RolesAndPermissionsSeeder` auf allen Umgebungen ausführen (neue Permissions). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
109 lines
4.7 KiB
PHP
109 lines
4.7 KiB
PHP
<?php
|
|
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Volt\Component;
|
|
use Spatie\Permission\Models\Role;
|
|
|
|
new #[Layout('components.layouts.app'), Title('Rollen & Rechte')] class extends Component
|
|
{
|
|
public function mount(): void
|
|
{
|
|
$this->authorize('roles:manage');
|
|
}
|
|
|
|
public function with(): array
|
|
{
|
|
return [
|
|
'roles' => Role::query()
|
|
->withCount(['users', 'permissions'])
|
|
->orderBy('name')
|
|
->get(),
|
|
];
|
|
}
|
|
}; ?>
|
|
|
|
<div class="space-y-8">
|
|
{{-- ============== PAGE HEADER ============== --}}
|
|
<x-portal.page-header
|
|
:badge="__('Admin Backend')"
|
|
:eyebrow="__('Administration · Sicherheit')"
|
|
:title="__('Rollen')"
|
|
:description="__('Verwaltung von Rollen und Berechtigungen')"
|
|
>
|
|
<x-slot:actions>
|
|
@if (\Illuminate\Support\Facades\Route::has('admin.roles.create'))
|
|
<flux:button variant="primary" icon="plus" href="{{ route('admin.roles.create') }}" wire:navigate>
|
|
{{ __('Neue Rolle') }}
|
|
</flux:button>
|
|
@endif
|
|
</x-slot:actions>
|
|
</x-portal.page-header>
|
|
|
|
<article class="panel overflow-hidden">
|
|
<div class="panel-head">
|
|
<span class="section-eyebrow">{{ __('Alle Rollen') }}</span>
|
|
<span class="text-[11.5px] text-[color:var(--color-ink-3)]">
|
|
{{ __(':count Einträge', ['count' => $roles->count()]) }}
|
|
</span>
|
|
</div>
|
|
<flux:table>
|
|
<flux:table.columns>
|
|
<flux:table.column>{{ __('Name') }}</flux:table.column>
|
|
<flux:table.column>{{ __('Benutzer') }}</flux:table.column>
|
|
<flux:table.column>{{ __('Berechtigungen') }}</flux:table.column>
|
|
<flux:table.column>{{ __('Typ') }}</flux:table.column>
|
|
<flux:table.column>{{ __('Aktionen') }}</flux:table.column>
|
|
</flux:table.columns>
|
|
|
|
<flux:table.rows>
|
|
@forelse ($roles as $role)
|
|
<flux:table.row :key="$role->id">
|
|
<flux:table.cell>
|
|
<div>
|
|
<div class="text-[13px] font-semibold text-[color:var(--color-ink)]">{{ str($role->name)->replace('-', ' ')->title() }}</div>
|
|
<div class="text-[11.5px] text-[color:var(--color-ink-3)] font-mono">{{ $role->name }}</div>
|
|
</div>
|
|
</flux:table.cell>
|
|
|
|
<flux:table.cell>
|
|
<span class="badge dot">{{ $role->users_count }}</span>
|
|
</flux:table.cell>
|
|
|
|
<flux:table.cell>
|
|
<span class="badge hub">{{ $role->permissions_count }}</span>
|
|
</flux:table.cell>
|
|
|
|
<flux:table.cell>
|
|
@if (in_array($role->name, ['admin', 'editor', 'customer', 'api-only'], true))
|
|
<span class="badge hub dot">{{ __('System') }}</span>
|
|
@else
|
|
<span class="badge ok dot">{{ __('Custom') }}</span>
|
|
@endif
|
|
</flux:table.cell>
|
|
|
|
<flux:table.cell>
|
|
@if (\Illuminate\Support\Facades\Route::has('admin.roles.edit'))
|
|
<flux:button size="sm" variant="filled" icon="pencil" href="{{ route('admin.roles.edit', $role->id) }}" wire:navigate />
|
|
@endif
|
|
</flux:table.cell>
|
|
</flux:table.row>
|
|
@empty
|
|
<flux:table.row>
|
|
<flux:table.cell colspan="5">
|
|
<div class="flex flex-col items-center justify-center px-4 py-10 text-center">
|
|
<div class="w-14 h-14 rounded-[6px] flex items-center justify-center mb-3
|
|
bg-[color:var(--color-hub-soft)] border border-[color:var(--color-hub-soft-2)] text-[color:var(--color-hub)]">
|
|
<flux:icon.shield-check class="size-6" />
|
|
</div>
|
|
<div class="text-[14px] font-semibold text-[color:var(--color-ink)] mb-1">
|
|
{{ __('Keine Rollen gefunden') }}
|
|
</div>
|
|
</div>
|
|
</flux:table.cell>
|
|
</flux:table.row>
|
|
@endforelse
|
|
</flux:table.rows>
|
|
</flux:table>
|
|
</article>
|
|
</div>
|