@php $acl = collect($node['__acl'] ?? []); $children = $node['__children'] ?? []; $hasChildren = !empty($children); $secuGroups = $acl->filter(fn($e) => str_starts_with($e->principal, 'SECU-'))->unique(fn($e) => $e->principal . '|' . $e->droits . '|' . $e->est_herite); $directUsers = $acl->filter(fn($e) => !str_starts_with($e->principal, 'SECU-') && !$e->est_herite)->unique(fn($e) => $e->principal . '|' . $e->droits); $inheritedAll = $acl->filter(fn($e) => $e->est_herite && !str_starts_with($e->principal, 'SECU-')); @endphp
@if($hasChildren) @else ● @endif {{ $name }} @if($secuGroups->isNotEmpty()) {{ $secuGroups->count() }} groupe(s) @endif @if($directUsers->isNotEmpty()) {{ $directUsers->count() }} direct(s) @endif
@if($secuGroups->isNotEmpty() || $directUsers->isNotEmpty() || $inheritedAll->isNotEmpty())
@if($secuGroups->isNotEmpty())
Groupes SECU-
@foreach($secuGroups as $entry)
{{ $entry->principal }} {{ $entry->droits }} @if($entry->est_herite) (hérité) @endif
@endforeach @endif @if($directUsers->isNotEmpty())
Utilisateurs directs
@foreach($directUsers as $entry)
{{ $entry->principal }} @if($entry->email) {{ $entry->email }} @endif {{ $entry->droits }}
@endforeach @endif @if($inheritedAll->isNotEmpty())
Hérités (autres)
@foreach($inheritedAll as $entry)
{{ $entry->principal }} {{ $entry->droits }}
@endforeach @endif
@endif @if($hasChildren)
@foreach($children as $cName => $cNode) @include('permissions._tree_node', ['name' => $cName, 'node' => $cNode, 'depth' => $depth + 1]) @endforeach
@endif