Files
Wallos/endpoints/admin/enableoidc.php
Ali Khattab b9567c3d2e Add declarative OIDC (#1056)
* feat(oidc): add declarative runtime configuration

* feat(admin): reflect env-managed oidc settings

* docs(oidc): document environment variables

* chore: match repo line endings and dedupe compose comment

---------

Co-authored-by: Miguel Ribeiro <k.d.mitnick@gmail.com>
2026-07-09 22:54:12 +02:00

34 lines
984 B
PHP

<?php
require_once '../../includes/connect_endpoint.php';
require_once '../../includes/validate_endpoint_admin.php';
require_once '../../includes/oidc_settings.php';
$postData = file_get_contents("php://input");
$data = json_decode($postData, true);
$oidcEnabled = isset($data['oidcEnabled']) ? $data['oidcEnabled'] : 0;
if (wallos_has_oidc_env_value('OIDC_ENABLED')) {
die(json_encode([
"success" => false,
"message" => "OIDC enablement is managed by the OIDC_ENABLED environment variable."
]));
}
$stmt = $db->prepare('UPDATE admin SET oidc_oauth_enabled = :oidcEnabled WHERE id = 1');
$stmt->bindParam(':oidcEnabled', $oidcEnabled, SQLITE3_INTEGER);
$stmt->execute();
if ($db->changes() > 0) {
die(json_encode([
"success" => true,
"message" => translate('success', $i18n)
]));
} else {
die(json_encode([
"success" => false,
"message" => translate('error', $i18n)
]));
}