@extends('layouts.app', ['title' => $label.' access', 'wide' => true]) @php($short = fn ($name) => \Illuminate\Support\Str::after($name, ':')) @php($label2 = fn ($s) => \Illuminate\Support\Str::of($s)->replace(['-', '_'], ' ')->headline()) @php($tabUrl = fn ($t) => route('admin.access.show', [$client, 'tab' => $t])) @php($roleUrl = fn ($r) => route('admin.access.show', [$client, 'role' => $short($r->name)])) @push('styles') @endpush @section('content') @if ($errors->any())
@foreach ($errors->all() as $error)

{{ $error }}

@endforeach
@endif
Access / {{ $label }}

{{ $label }} {{ $client }}

Changes take effect the next time someone signs in to {{ $label }} (or within a minute, when its session re-checks).

{{-- ================================================================ Roles --}} @if ($tab === 'roles')
@if ($creating)
@csrf

New role

Stored as {{ $client }}:<name>. Letters, digits, and - _ . or spaces.

Permissions

@if ($permissionGroups->isEmpty())

No permissions defined for this web yet — add some first.

@else @include('admin.access._permission-grid', [ 'checked' => old('permissions', []), 'copyFrom' => $roles, ]) @endif
Pick a name and the permissions this role grants.
@if ($roles->isNotEmpty()) Cancel @endif
@elseif ($selected) @php($isProtected = in_array($selected->name, $protected, true))
@csrf @method('PUT')

{{ $short($selected->name) }} @if ($isProtected) protected @endif

{{ $selected->name }} · held by {{ $selected->users_count }} {{ \Illuminate\Support\Str::plural('account', $selected->users_count) }}

@if ($permissionGroups->isEmpty())

No permissions defined for this web yet — add some.

@else @include('admin.access._permission-grid', [ 'checked' => $selected->permissions->pluck('name')->all(), 'copyFrom' => $roles->reject(fn ($r) => $r->is($selected)), ]) @endif
All changes saved.

Accounts with this role

@if ($members->isEmpty())

Nobody holds this role yet. Assign it from a user's page on the Users screen.

@else @endif
@unless ($isProtected)

Delete role

Also unassigns it from the {{ $selected->users_count }} account(s) that hold it.

@csrf @method('DELETE')
@endunless @endif
@endif {{-- ============================================================== Compare --}} @if ($tab === 'matrix')
@if ($roles->isEmpty() || $permissions->isEmpty())

Nothing to compare yet.

@else
Click a role name to edit it.
@foreach ($roles as $role) @endforeach @foreach ($permissionGroups as $group => $items) @foreach ($items as $item) @php($permission = $item['permission']) @foreach ($roles as $role) @endforeach @endforeach @endforeach @foreach ($roles as $role) @endforeach
Permission{{ $short($role->name) }}
{{ $label2($group) }}
{{ $short($permission->name) }} @if ($role->permissions->contains('name', $permission->name)) ✓ @else · @endif
Total{{ $role->permissions->count() }}
@endif
@endif {{-- ========================================================== Permissions --}} @if ($tab === 'permissions')

Add a permission

@csrf

A permission only does something if {{ $label }} checks for it by this exact name — resource.action (e.g. articles.edit) or action resource (e.g. view files). Similar names are grouped by the resource they act on.

@if ($permissions->isEmpty())

No permissions yet.

@else
@foreach ($permissionGroups as $group => $items) @foreach ($items as $item) @php($permission = $item['permission']) @php($heldBy = $roles->filter(fn ($r) => $r->permissions->contains('name', $permission->name))) @endforeach @endforeach
PermissionGranted to roles
{{ $label2($group) }}
{{ $short($permission->name) }} @if ($heldBy->isEmpty()) unused @else
@foreach ($heldBy as $r) {{ $short($r->name) }} @endforeach
@endif
@csrf @method('DELETE')
@endif
@endif @endsection @push('scripts') @endpush