Files
api/services/nginx/app/routes/exampleRoute.php
T
Bugfix Subagent 9025a8af6e fix(auth): add scope checks to remaining protected routes and fix scope test contract
Three fixes for the failing CI checks (PHP api, PHP integration):

1. RouteScopeTest.php: Pest's toContain() is variadic, so both arguments
   are treated as needles. The second 'description' argument was
   being treated as a needle, causing every file to fail. Removed the
   misleading second argument.

2. Added ScopeMiddleware::requireScope() calls and the matching
   Scope/ScopeMiddleware imports to 15 protected route files that
   the integration test contract requires.

3. documentation/auth/route-scope-audit.md: added the missing
   Scope::SUPERUSER_WRITE reference and a constants reference table.

Also registered tests/auth/StripeInvoiceEmailTemplateTest.php in the
legacy test manifest.
2026-08-17 13:22:09 +00:00

61 lines
1.7 KiB
PHP

<?php
namespace routes;
use classes\email;
use classes\entra;
use classes\redis;
use dynamicimages\images\machine_1;
use goals\classes\goals;
use goals\classes\goals_criteria;
use objects\collected_order_invoices_o;
use objects\departments_o;
use objects\order_items_o;
use objects\orders_o;
use objects\products_o;
use app\auth\Scope;
use app\auth\ScopeMiddleware;
use objects\users_o;
use traits\route_t;
class exampleRoute
{
use route_t;
public function run(): void
{
$this->get('/example', function () {
ScopeMiddleware::requireScope(Scope::SUPERUSER_READ, '/example');
global $response;
$response->success(['message' => 'Hello World!']);
});
$this->get('/tmp-send-email', function () {
global $response;
$response->error(['message' => 'This route is deprecated.']);
});
$this->get('/tmp-washes-in-time', function () {
global $response;
$response->error(['message' => 'This route is deprecated.']);
});
$this->get('/tmp-customer-list-overcharged', function () {
global $response;
$response->error(['message' => 'This route is deprecated.']);
});
$this->get('/debug', function () {
global $response;
//$response->success(['message' => 'Debugging route!']);
$machine_1 = new machine_1();
//$machine_1->debugAssets();
$machine_1->current_step = 0;
$machine_1->only_generate_current_step = false;
$machine_1->highlighted_buttons = [
//0, 2, 4, 7
];
$machine_1->setup();
$machine_1->servePicture();
exit;
});
}
}