<?php
declare(strict_types=1);

require_once __DIR__ . '/../../api/system/response.php';

if (session_status() !== PHP_SESSION_ACTIVE) {
    session_start();
}

if (!isset($_SESSION['user_id'])) {
    error_unauthorized('Authentication required');
}

if (!isset($_SESSION['product_id']) && empty($_SESSION['is_global'])) {
    error_forbidden('Product scope missing');
}
