@@ -43,7 +43,40 @@ if (! is_dir($sessions)) {
|
||||
mkdir($sessions, 0700, true);
|
||||
}
|
||||
config(['session.files' => $sessions]);
|
||||
config(['portal.opportunity_dashboard_access_enabled' => true, 'portal.qa_build_directory' => 'build-qa-opportunities']);
|
||||
config(['portal.opportunity_specialized_drafts_enabled' => true]);
|
||||
config(['portal.profile_access_enabled' => true]);
|
||||
// QA-only bootstrap ceremony: fixed synthetic identities, normal authenticated MFA.
|
||||
Illuminate\Support\Facades\Route::middleware(['web', 'auth', 'verified', \App\Http\Middleware\EnsurePortalProfiles::class])->post('/qa-auditoria/perfis/inicializar', function (Request $request) use ($dir) {
|
||||
$actors = json_decode(file_get_contents($dir.'/portal-audit/profiles-v1-actors-private.json'), true, 512, JSON_THROW_ON_ERROR);
|
||||
abort_unless($request->user()->id === $actors['bootstrap']['id'], 403);
|
||||
config(['portal_profiles.bootstrap_authorized' => true]);
|
||||
try {
|
||||
app(\App\Services\PortalSuperusers::class)->initialize(User::findOrFail($actors['super_first']['id']), User::findOrFail($actors['super_second']['id']), $request->user());
|
||||
} finally {
|
||||
config(['portal_profiles.bootstrap_authorized' => false]);
|
||||
}
|
||||
return response()->json(['initialized' => true, 'holders' => [$actors['super_first']['id'], $actors['super_second']['id']]]);
|
||||
});
|
||||
// Read-only report derived from the sole audit matrix, accessible only on QA.
|
||||
function authorizeQaAuditReader(Request $request): void
|
||||
{
|
||||
$access = app(\App\Services\PortalProfileAccess::class);
|
||||
abort_unless($request->user()->can('manage-portal') || $access->has($request->user(), 'auditor') || ($access->superuser($request->user()) && $access->mfa($request->user())), 403);
|
||||
}
|
||||
Illuminate\Support\Facades\Route::middleware(['web', 'auth', 'verified'])->get('/qa-auditoria/pedidos-abertos', function (Request $request) use ($dir) {
|
||||
authorizeQaAuditReader($request);
|
||||
return response()->file($dir.'/portal-audit/pedidos-abertos.html', ['Cache-Control' => 'private, no-store']);
|
||||
});
|
||||
foreach (['relatorio-executivo', 'backlog', 'perfis-v1-reconciliacao', 'roteiro-manual-perfis-v1'] as $reportName) {
|
||||
Illuminate\Support\Facades\Route::middleware(['web', 'auth', 'verified'])->get('/qa-auditoria/'.$reportName, function (Request $request) use ($root, $reportName) {
|
||||
authorizeQaAuditReader($request);
|
||||
$content = file_get_contents($root.'/docs/investmoz/v2/auditoria-portal/'.$reportName.'.md');
|
||||
return response('<!doctype html><html lang="pt"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>InvestMoz — '.$reportName.'</title><style>body{font:16px/1.55 system-ui;max-width:1100px;margin:auto;padding:24px}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit}</style><pre>'.htmlspecialchars($content, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8').'</pre></html>')->header('Cache-Control', 'private, no-store');
|
||||
});
|
||||
}
|
||||
Vite::useHotFile($root.'/storage/framework/qa-opportunity-resources-hot-absent');
|
||||
Vite::useBuildDirectory('build-qa-opportunities');
|
||||
if (PHP_SAPI === 'cli' && ($argv[1] ?? '') === 'prepare') {
|
||||
$migration = require $root.'/database/migrations/'.OpportunityResourceInstallation::MIGRATION.'.php';
|
||||
$migration->up();
|
||||
|
||||
Reference in New Issue
Block a user