<?php
declare(strict_types=1);$_SERVER['HTTP_HOST']='customer.read.invalid';$_SERVER['HTTP_PLATFORM']='POC';$_SERVER['REQUEST_METHOD']='GET';$_SERVER['REQUEST_URI']='/api/points.Log/list';$_SERVER['SCRIPT_NAME']='/index.php';require __DIR__.'/app.php';require __DIR__.'/data.php';ck(!file_exists($runtime.'/guard-attempt.json'),'Only one token/actor');saveOnce('guard-attempt.json',['at'=>date('c'),'actor'=>actorId()]);$app=coreApp('GUARD');require_once $root.'/app/api/common.php';$token='CDXCUSTOMERREAD_'.$lane.'_'.bin2hex(random_bytes(24));saveOnce('tokens.json',['U1'=>$token]);ck(\think\facade\Cache::set($token,['user'=>['user_id'=>actorId()],'password_version'=>0,'login_type'=>'thirdparty'],300),'Original own one token');$u=\app\api\model\User::getUserByToken($token);ck($u&&(int)$u['user_id']===actorId()&&(int)$u['store_id']===10001,'Original marked API Auth/tenant');$controller=new \app\api\controller\points\Log($app);saveOnce('guard.json',['actor'=>actorId(),'original_API_auth'=>true,'original_store_controller'=>true,'HTTP'=>0,'DML'=>0]);echo json_encode(['lane'=>$lane,'actor'=>actorId(),'auth'=>true,'HTTP'=>0,'DML'=>0]),"\n";
