mirror of
https://github.com/ellite/Wallos.git
synced 2026-07-31 10:16:03 -04:00
* 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>
34 lines
984 B
PHP
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)
|
|
]));
|
|
}
|