Files
portal/app/config/admin.php
T
Дмитрий 0c26afd03e
Accessibility (Pa11y live) / a11y (push) Waiting to run
SAST — Semgrep / Semgrep SAST scan (push) Waiting to run
fix(admin): починка 500 на admin-сохранениях (audit-id из config, без saas_admin_users) + тариф текущей датой
2026-06-21 11:32:53 +03:00

30 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
return [
// Логины nginx HTTP Basic Auth (.htpasswd-admin), допущенные в saas-admin зону.
// CSV из env; дефолт совпадает с прод-.htpasswd (единственный логин — admin).
'basic_auth_allowlist' => array_values(array_filter(array_map(
'trim',
explode(',', (string) env('ADMIN_ALLOWED_USERS', 'admin')),
))),
// Включение fail-closed гейта. В local/testing — выкл (nginx нет, тесты
// аутентифицируются иначе); на проде/staging — вкл. Только env() — config
// грузится до готовности контейнера, app()->environment() здесь падает.
'basic_auth_gate' => (bool) env(
'ADMIN_GATE_ENFORCED',
! in_array(env('APP_ENV', 'production'), ['local', 'testing'], true),
),
// Системный saas_admin_users.id для audit-trail admin-действий (FK
// saas_admin_audit_log.admin_user_id). На проде рантайм-роль crm_app_user НЕ
// имеет прав на saas_admin_users (админ-креды изолированы) → задаём id здесь,
// чтобы не обращаться к таблице. null (dev/test, суперюзер) → fallback на
// авто-создание стаба. На проде — ADMIN_AUDIT_SYSTEM_USER_ID=1 (сид-стаб).
'audit_system_user_id' => env('ADMIN_AUDIT_SYSTEM_USER_ID') !== null
? (int) env('ADMIN_AUDIT_SYSTEM_USER_ID')
: null,
];