forked from fa/breadcrumb-the-shire
25 lines
641 B
PHP
25 lines
641 B
PHP
<?php
|
|
|
|
use MintyPHP\Module\Security\SecurityAuthorizationPolicy;
|
|
use MintyPHP\Module\Security\Service\SecurityBcGateway;
|
|
use MintyPHP\Router;
|
|
use MintyPHP\Support\Guard;
|
|
|
|
Guard::requireLogin();
|
|
Guard::requireAbilityOrForbidden(SecurityAuthorizationPolicy::ABILITY_SETTINGS_MANAGE);
|
|
gridRequireGetRequest();
|
|
|
|
$result = app(SecurityBcGateway::class)->testConnection();
|
|
|
|
if (($result['ok'] ?? false) === true) {
|
|
Router::json(['ok' => true, 'http_code' => (int) ($result['http_code'] ?? 200)]);
|
|
|
|
return;
|
|
}
|
|
|
|
http_response_code(200);
|
|
Router::json([
|
|
'ok' => false,
|
|
'error' => (string) ($result['error'] ?? 'Connection failed'),
|
|
]);
|