47 lines
3.1 KiB
PHP
47 lines
3.1 KiB
PHP
<?php
|
|
ini_set('zend.exception_ignore_args', '1');
|
|
putenv('STABILITY_QA_MODE=consumers');
|
|
$reviewRoot = dirname(__DIR__, 2);
|
|
$reviewQA = $reviewRoot.'/storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742';
|
|
$reviewReceipt = __DIR__.'/case32-reviewer-context-readonly-20261013.json';
|
|
if (is_file($reviewReceipt)) { throw new RuntimeException('Verificação já registada.'); }
|
|
$app = require $reviewQA.'/tools/portal-stability-runtime.php';
|
|
$db = Illuminate\Support\Facades\DB::connection();
|
|
$target = (array) $db->selectOne('SELECT current_database() AS database, inet_server_port() AS port');
|
|
if ($target !== ['database'=>'stability_consumers_20261011_084534_test', 'port'=>55441]) {
|
|
throw new RuntimeException('QA isolada obrigatória.');
|
|
}
|
|
$db->beginTransaction();
|
|
$db->statement('SET TRANSACTION READ ONLY');
|
|
try {
|
|
$record = App\Models\Opportunity::findOrFail(32);
|
|
$actor = App\Models\User::findOrFail(24);
|
|
$access = app(App\Services\PortalProfileAccess::class);
|
|
$grant = $access->scoped($actor, 'validator', $record->organization_id, $record->opportunity_category);
|
|
$canView = $access->canView($actor, $record);
|
|
$operational = $access->operational($actor, 'validate', 32);
|
|
$conflict = $access->conflict($actor, $record);
|
|
$enrolled = $actor->two_factor_confirmed_at !== null && $actor->two_factor_secret !== null;
|
|
$assignment = $record->workflow_context['assignment']['assignee_user_id'] ?? null;
|
|
$assignmentAllows = $assignment === null || (int) $assignment === 24;
|
|
$receipt = [
|
|
'at'=>gmdate('c'), 'target'=>$target, 'SQL_read_only'=>true,
|
|
'opportunity_id'=>32, 'QA_account'=>24, 'working_state'=>$access->state($record),
|
|
'profile_access_available'=>$access->available(), 'can_view'=>$canView,
|
|
'validator_scope_matches'=>$grant, 'operational_validation_permitted'=>$operational,
|
|
'conflict'=>$conflict, 'MFA_enrollment_confirmed'=>$enrolled,
|
|
'review_assignment_allows_QA24'=>$assignmentAllows,
|
|
'CLI_has_authenticated_MFA_session'=>false,
|
|
'stored_authorization_prerequisites_satisfied'=>$canView && $grant && $operational && ! $conflict && $enrolled && $assignmentAllows,
|
|
'explanation'=>'OpportunityProfileWorkflow::actions only offers reviewer actions if PortalProfileAccess::mfa confirms a fresh authenticated session. A read-only CLI query is not a browser MFA session; its empty action list is not evidence of missing QA24 permissions.',
|
|
'no_authenticated_session_simulated'=>true,
|
|
'limits'=>['Browser actions still require observation in the actual QA24 session.', 'This is a diagnostic-context correction, not a product permission or MFA change.'],
|
|
'QA_database_changes'=>0, 'active_changes'=>0,
|
|
];
|
|
file_put_contents($reviewReceipt, json_encode($receipt, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR).PHP_EOL);
|
|
echo json_encode(['QA24_stored_prerequisites_satisfied'=>$receipt['stored_authorization_prerequisites_satisfied'],
|
|
'empty_CLI_actions_not_product_failure'=>true, 'conflict'=>$conflict, 'active_changes'=>0], JSON_THROW_ON_ERROR).PHP_EOL;
|
|
} finally {
|
|
$db->rollBack();
|
|
}
|