<?php

namespace App\Http\Middleware;

use App\Support\OperatorAccess;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;

class EnsureOperatorAccess
{
    public function handle(Request $request, Closure $next): Response
    {
        abort_unless(OperatorAccess::allows($request->user()), 403);

        return $next($request);
    }
}
