summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/locationinfo/hooks/runmode/config.json5
-rw-r--r--modules-available/locationinfo/inc/locationinfo.inc.php8
-rw-r--r--modules-available/runmode/baseconfig/getconfig.inc.php29
-rw-r--r--modules-available/runmode/inc/runmode.inc.php14
4 files changed, 53 insertions, 3 deletions
diff --git a/modules-available/locationinfo/hooks/runmode/config.json b/modules-available/locationinfo/hooks/runmode/config.json
index 8c1ebad8..c88b20cf 100644
--- a/modules-available/locationinfo/hooks/runmode/config.json
+++ b/modules-available/locationinfo/hooks/runmode/config.json
@@ -1,4 +1,7 @@
{
"getModeName": "LocationInfo::getPanelName",
- "isClient": false
+ "isClient": false,
+ "configHook": "LocationInfo::configHook",
+ "noSysconfig": true,
+ "systemdDefaultTarget": "multi-user"
} \ No newline at end of file
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php
index 36a77d4f..6e6cfcd7 100644
--- a/modules-available/locationinfo/inc/locationinfo.inc.php
+++ b/modules-available/locationinfo/inc/locationinfo.inc.php
@@ -86,4 +86,12 @@ class LocationInfo
return $ret['panelname'];
}
+ public static function configHook($machineUuid, $panelUuid)
+ {
+ // TODO Panel type
+ ConfigHolder::add('SLX_BROWSER_URL', 'http://' . $_SERVER['SERVER_ADDR'] . '/panel/' . $panelUuid);
+ ConfigHolder::add('SLX_ADDONS', '', 1000);
+ ConfigHolder::add('SLX_LOGOUT_TIMEOUT', 1000);
+ }
+
}
diff --git a/modules-available/runmode/baseconfig/getconfig.inc.php b/modules-available/runmode/baseconfig/getconfig.inc.php
new file mode 100644
index 00000000..fe04b5ef
--- /dev/null
+++ b/modules-available/runmode/baseconfig/getconfig.inc.php
@@ -0,0 +1,29 @@
+<?php
+
+$foofoo = function($machineUuid) {
+ $res = Database::queryFirst('SELECT module, modeid, modedata FROM runmode WHERE machineuuid = :uuid',
+ array('uuid' => $machineUuid));
+ if ($res === false)
+ return;
+ $config = RunMode::getModuleConfig($res['module']);
+ if ($config === false || $config->configHook === false)
+ return;
+ if (!Module::isAvailable($res['module']))
+ return; // Not really possible because getModuleConfig would have failed but we should make sure
+ call_user_func($config->configHook, $machineUuid, $res['modeid'], $res['modedata']);
+ if ($config->systemdDefaultTarget !== false) {
+ ConfigHolder::add('SLX_SYSTEMD_TARGET', $config->systemdDefaultTarget, 10000);
+ }
+ if ($config->noSysconfig) {
+ ConfigHolder::add('SLX_NO_CONFIG_TGZ', '1', 10000);
+ }
+ // Disable exam mode - not sure if this is generally a good idea; for now, all modes we can think of would
+ // not make sense that way so do this for now
+ if (ConfigHolder::get('SLX_EXAM') !== false) {
+ ConfigHolder::add('SLX_EXAM', '', 100001);
+ ConfigHolder::add('SLX_EXAM_START', '', 100001);
+ ConfigHolder::add('SLX_AUTOLOGIN', '', 100001);
+ }
+};
+
+$foofoo($uuid); \ No newline at end of file
diff --git a/modules-available/runmode/inc/runmode.inc.php b/modules-available/runmode/inc/runmode.inc.php
index 5b59f1c1..916866f1 100644
--- a/modules-available/runmode/inc/runmode.inc.php
+++ b/modules-available/runmode/inc/runmode.inc.php
@@ -11,7 +11,7 @@ class RunMode
* @param string $module name of module
* @return RunModeModuleConfig|false
*/
- private static function getModuleConfig($module)
+ public static function getModuleConfig($module)
{
if (isset(self::$moduleConfigs[$module]))
return self::$moduleConfigs[$module];
@@ -155,9 +155,17 @@ class RunModeModuleConfig
*/
public $getModeName = false;
/**
+ * @var string Name of function that is called to add additional config entries
+ */
+ public $configHook = false;
+ /**
* @var bool Consider this a normal client that should e.g. be shown in client statistics by default
*/
public $isClient = false;
+ /**
+ * @var bool If true, config.tgz should not be downloaded by the client
+ */
+ public $noSysconfig = false;
public function __construct($file)
{
@@ -168,7 +176,9 @@ class RunModeModuleConfig
$this->loadType($data, 'systemdDisableTargets', 'array');
$this->loadType($data, 'systemdEnableTargets', 'array');
$this->loadType($data, 'getModeName', 'string');
- $this->loadType($data, 'isClient', 'string');
+ $this->loadType($data, 'configHook', 'string');
+ $this->loadType($data, 'isClient', 'boolean');
+ $this->loadType($data, 'noSysconfig', 'boolean');
}
private function loadType($data, $key, $type)