@extends('layouts.app') @section('title', 'Roles & Permissions') @php $locked = $selected?->isLocked(); $granted = $selected ? ($selected->hasFullAccess() ? \App\Support\Permissions::all() : ($selected->permissions ?? [])) : []; $canEdit = auth()->user()->can('roles.manage'); $totalPerms = count(\App\Support\Permissions::all()); @endphp @section('content')

Roles & Permissions

Choose a role, then tick what people in that role may open and do. Changes apply as soon as they open their next page. Every role except Administrator can be customised.

@if ($canEdit) @endif
{{-- Role list --}} {{-- Selected role --}}
@if ($selected)
@csrf @method('PUT')
@if ($locked)
Administrators always have full access. This is locked so that nobody can accidentally shut themselves out of the system.
@endif
of {{ $totalPerms }} allowed {{ $selected->users_count }} {{ \Illuminate\Support\Str::plural('person', $selected->users_count) }} in this role
{{-- Tabs --}}
@foreach ($sections as $key => $section) @endforeach
@foreach ($sections as $key => $section)

{{ $section['hint'] }}

@foreach ($catalog[$key] as $group => $items) @php $keys = array_keys($items); @endphp

{{ $group }}

@unless ($locked || ! $canEdit) @endunless
@foreach ($items as $perm => $meta) @endforeach
@endforeach
@endforeach {{-- Only what is currently ticked is submitted --}}
@if ($canEdit)
@if (! $selected->is_system && $selected->users_count === 0) @endif @if ($selected->is_system && ! $locked) @endif
@unless ($locked) @endunless
@endif
@if ($canEdit)
@csrf @method('DELETE')
@csrf
@endif @endif
@if ($canEdit)
@csrf

You can change every tick afterwards.

@endif
@endsection