{{-- Roles & Permissions — the company's roles, who holds each and what it opens. Obvizio's /roles screen over Worklance's permission catalog. --}} @extends('layouts.app') @php use App\Support\Permissions; $pages = Permissions::pageNames(); @endphp @section('header')
Administration

Roles & Permissions

Company: {{ $company?->name ?? 'None' }}
@endsection @section('content')
@forelse ($roles as $role) @php $held = $role->permissions->pluck('name')->all(); $screens = array_values(array_intersect($pages, $held)); $isWs = in_array($role->name, $mirrored, true) || in_array(\Illuminate\Support\Str::slug((string) $role->label, '_'), $mirrored, true); $scope = in_array(Permissions::VIEW_ALL, $held, true) ? 'Everyone' : (in_array(Permissions::VIEW_TEAM, $held, true) ? 'Their teams' : 'Only themselves'); @endphp @empty @endforelse
Role People Screens Whose data Permissions
{{ $role->label ?? $role->name }} @if ($isWs) Workspace @endif @if ($role->company_id === null) Global @endif
{{ $role->name }}
{{ $role->users_count }} @if ($screens)
@foreach ($screens as $p) {{ Permissions::label($p) }} @endforeach
@else None — desktop only @endif
{{ $screens ? $scope : '—' }} {{ count($held) }} / {{ $total }} Permissions @if ($role->company_id !== null || auth()->user()->isSuperAdmin()) @endif
No roles yet — create one, or Sync Workspace Users to bring the workspace’s roles across.
{{-- Modals — outside the table. --}} @foreach ($roles as $role) @continue($role->company_id === null && ! auth()->user()->isSuperAdmin()) @php $rkey = "role-rename-{$role->id}"; $rErr = old('form_key') === $rkey; @endphp @endforeach @php $cErr = old('form_key') === 'role-create'; @endphp @include('admin.partials.modal-form-ux') @endsection