Make managed mode off by default and turned on per side in config.php - $config_enable_managed_instances = true; adds Admin > Managed Instances, the api/managed endpoints and the Managed Instances cron job, and $config_enable_managed_by = true; (or $config_manager_required = true;) adds Admin > Managed By, the Manager Check-in cron job and support sign-in; with a side off its menu entry, pages, modal, post handler and cron job are gone, the manager endpoints answer 503 so instances keep their connection and retry, a connected instance stops checking in and its locks, read-only and suspended lift while its connection is kept, any open support session is ended, and the support user still takes no seat; new managerEnabled(), managedEnabled() and managedConnected(), the cron registry and health check leave out the jobs of a side that is off, changelog updated

This commit is contained in:
johnnyq
2026-11-05 20:17:42 -05:00
parent b5ceeb4eaf
commit 87cdf79b28
14 changed files with 167 additions and 27 deletions

View File

@@ -4,6 +4,9 @@
* ITFlow - managed mode's two endpoints, as a manager: enroll.php (an instance connecting
* with a code) and checkin.php (a connected instance reporting in). The instances call these;
* nothing else should. Each answers JSON to a JSON POST - see functions/managed.php.
*
* Off unless config.php turns this side on ($config_enable_managed_instances) - then both say
* so with a 503, which an instance takes as "not now": it keeps its connection and tries again.
*/
require_once __DIR__ . '/../../config.php';
@@ -19,6 +22,10 @@ $managed_api_reply = function (int $status, array $answer) {
exit;
};
if (!managerEnabled()) {
$managed_api_reply(503, ['error' => "This ITFlow isn't managing other installs - Managed Instances is off in its config.php"]);
}
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
$managed_api_reply(405, ['error' => 'POST only']);
}