fix(rbac): resolve custom role blank view and clarify default vs direct permissions
This commit is contained in:
@@ -175,8 +175,7 @@
|
||||
</svg>
|
||||
<span>Dashboard Admin</span>
|
||||
</a>
|
||||
@elseif(auth()->user()->isHseAdmin())
|
||||
@can('hse.employees.view')
|
||||
@elseif(auth()->user()->can('hse.employees.view') && !auth()->user()->canAny(['qma.vehicles.view', 'pg.guards.view', 'employee.dashboard']))
|
||||
<a href="{{ route('hse.dashboard') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('hse.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
@@ -187,9 +186,7 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
@elseif(auth()->user()->isQmaAdmin())
|
||||
@can('qma.vehicles.view')
|
||||
@elseif(auth()->user()->can('qma.vehicles.view') && !auth()->user()->canAny(['pg.guards.view', 'employee.dashboard']))
|
||||
<a href="{{ route('qma.dashboard') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('qma.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
@@ -200,9 +197,7 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
@elseif(auth()->user()->isPgAdmin())
|
||||
@can('pg.guards.view')
|
||||
@elseif(auth()->user()->can('pg.guards.view') && !auth()->user()->can('employee.dashboard'))
|
||||
<a href="{{ route('pg.dashboard') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('pg.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
@@ -213,9 +208,7 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
@elseif(auth()->user()->isEmployee())
|
||||
@can('employee.dashboard')
|
||||
@elseif(auth()->user()->can('employee.dashboard') || auth()->user()->isEmployee())
|
||||
<a href="{{ route('employee.dashboard') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('employee.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
@@ -226,24 +219,23 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('employee.p2h')
|
||||
<a href="{{ route('p2h.index') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
|
||||
<span>Pemeriksaan P2H</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('employee.timesheet')
|
||||
<a href="{{ route('timesheet.index') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-car text-base w-5 text-center"></i>
|
||||
<span>Timesheet</span>
|
||||
</a>
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
@can('employee.p2h')
|
||||
<a href="{{ route('p2h.index') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
|
||||
<span>Pemeriksaan P2H</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('employee.timesheet')
|
||||
<a href="{{ route('timesheet.index') }}"
|
||||
class="flex items-center space-x-3 px-3.5 py-2.5 text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-car text-base w-5 text-center"></i>
|
||||
<span>Timesheet</span>
|
||||
</a>
|
||||
@endcan
|
||||
</nav>
|
||||
</div>
|
||||
@endif
|
||||
@@ -487,8 +479,7 @@
|
||||
</svg>
|
||||
<span>Dashboard Admin</span>
|
||||
</a>
|
||||
@elseif(auth()->user()->isHseAdmin())
|
||||
@can('hse.employees.view')
|
||||
@elseif(auth()->user()->can('hse.employees.view') && !auth()->user()->canAny(['qma.vehicles.view', 'pg.guards.view', 'employee.dashboard']))
|
||||
<a href="{{ route('hse.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('hse.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
|
||||
@@ -498,9 +489,7 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
@elseif(auth()->user()->isQmaAdmin())
|
||||
@can('qma.vehicles.view')
|
||||
@elseif(auth()->user()->can('qma.vehicles.view') && !auth()->user()->canAny(['pg.guards.view', 'employee.dashboard']))
|
||||
<a href="{{ route('qma.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('qma.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
|
||||
@@ -510,9 +499,7 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
@elseif(auth()->user()->isPgAdmin())
|
||||
@can('pg.guards.view')
|
||||
@elseif(auth()->user()->can('pg.guards.view') && !auth()->user()->can('employee.dashboard'))
|
||||
<a href="{{ route('pg.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('pg.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
|
||||
@@ -522,9 +509,7 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
@elseif(auth()->user()->isEmployee())
|
||||
@can('employee.dashboard')
|
||||
@elseif(auth()->user()->can('employee.dashboard') || auth()->user()->isEmployee())
|
||||
<a href="{{ route('employee.dashboard') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('employee.dashboard') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<svg class="w-5 h-5 flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="7" height="7" rx="2"></rect>
|
||||
@@ -534,22 +519,21 @@
|
||||
</svg>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('employee.p2h')
|
||||
<a href="{{ route('p2h.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
|
||||
<span>Pemeriksaan P2H</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('employee.timesheet')
|
||||
<a href="{{ route('timesheet.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-car text-base w-5 text-center"></i>
|
||||
<span>Timesheet</span>
|
||||
</a>
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
@can('employee.p2h')
|
||||
<a href="{{ route('p2h.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('p2h.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-clipboard-check text-base w-5 text-center"></i>
|
||||
<span>Pemeriksaan P2H</span>
|
||||
</a>
|
||||
@endcan
|
||||
|
||||
@can('employee.timesheet')
|
||||
<a href="{{ route('timesheet.index') }}" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl text-sm {{ request()->routeIs('timesheet.*') || request()->routeIs('mobilisasi.*') ? 'sidebar-item-active' : 'sidebar-item-inactive' }}">
|
||||
<i class="fa-solid fa-car text-base w-5 text-center"></i>
|
||||
<span>Timesheet</span>
|
||||
</a>
|
||||
@endcan
|
||||
</nav>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user