feat(auth): implement permission-based access for scanner functionality and update related tests

This commit is contained in:
2026-08-11 14:26:28 -03:00
parent 3eaa3f8202
commit 7d9489169d
10 changed files with 81 additions and 22 deletions

View File

@@ -3,7 +3,6 @@
namespace App\Domains\Auth\Services;
use App\Domains\Auth\Models\User;
use App\Domains\Authorization\Enums\RoleCode;
class ScannerContextService
{
@@ -13,7 +12,7 @@ class ScannerContextService
->with([
'menues' => fn ($query) => $query->whereHas(
'roles',
fn ($query) => $query->where('codigo', RoleCode::Scanner->value)
fn ($query) => $query->where('codigo', $user->rol_codigo)
),
])
->firstOrFail();