summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorralph isenmann2021-10-29 10:52:58 +0200
committerralph isenmann2021-10-29 10:52:58 +0200
commit4bd355c8b9724dec6268e71e9a18a326978d4317 (patch)
tree59d15a1b494f4485bbb1ac66d83b1a1eaa33e072
parent[baseconfig] Don't reenable shadowed config var (diff)
downloadslx-admin-4bd355c8b9724dec6268e71e9a18a326978d4317.tar.gz
slx-admin-4bd355c8b9724dec6268e71e9a18a326978d4317.tar.xz
slx-admin-4bd355c8b9724dec6268e71e9a18a326978d4317.zip
[dozmod] new resource to request image details
Updates: #3838
-rw-r--r--modules-available/dozmod/api.inc.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php
index d9f7354c..c2dc1cfa 100644
--- a/modules-available/dozmod/api.inc.php
+++ b/modules-available/dozmod/api.inc.php
@@ -17,7 +17,7 @@ if (!Module::isAvailable('locations')) {
define('LIST_URL', CONFIG_DOZMOD_URL . '/vmchooser/list');
define('VMX_URL', CONFIG_DOZMOD_URL . '/vmchooser/lecture');
-$availableRessources = ['list', 'vmx', 'netrules', 'runscript', 'metadata', 'netshares'];
+$availableRessources = ['list', 'vmx', 'netrules', 'runscript', 'metadata', 'netshares','imagemeta'];
/* BEGIN: A simple caching mechanism ---------------------------- */
@@ -272,6 +272,20 @@ function readLectureParam($locationIds)
}
+// in this context the lecture param is an image id (container),
+// just read and check if valid.
+// TODO do we need to check if this is allowed?
+function readImageParam()
+{
+ $image = Request::get('lecture', false, 'string');
+
+ if ($image === false) {
+ Header('HTTP/1.1 400 Bad Request');
+ die('Missing IMAGE UUID');
+ }
+ return $image;
+}
+
// -----------------------------------------------------------------------------//
/* request data, don't trust */
$resource = Request::get('resource', false, 'string');
@@ -299,6 +313,12 @@ if ($resource === 'list') {
outputLectureXmlForLocation($location_ids);
// Won't return on success...
fatalDozmodUnreachable();
+
+} elseif ($resource === 'imagemeta') {
+ $image = readImageParam();
+ outputResource($image, $resource);
+ fatalDozmodUnreachable();
+
} else {
$lecture = readLectureParam($location_ids);
outputResource($lecture, $resource);