From: Marcin Haba Date: Mon, 29 May 2023 11:13:48 +0000 (+0200) Subject: baculum: Change M365 tenants endpoint output to contain tenant names X-Git-Tag: Release-13.0.4~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987c86b19f39640d8488a2d42698458a01c45c83;p=thirdparty%2Fbacula.git baculum: Change M365 tenants endpoint output to contain tenant names --- diff --git a/gui/baculum/protected/API/Pages/API/PluginM365TenantList.php b/gui/baculum/protected/API/Pages/API/PluginM365TenantList.php index c4164efb8..c5c63e2e4 100644 --- a/gui/baculum/protected/API/Pages/API/PluginM365TenantList.php +++ b/gui/baculum/protected/API/Pages/API/PluginM365TenantList.php @@ -59,8 +59,15 @@ class PluginM365TenantList extends BaculumAPIServer { } $tenants = $this->getModule('fd_plugin_cfg')->getConfig('m365', $client); + $out = []; + foreach ($tenants as $tenant_id => $opts) { + $tenant_name = key_exists('tenant_name', $opts) ? $opts['tenant_name'] : ''; + $out[$tenant_id] = [ + 'tenant_name' => $tenant_name + ]; + } - $this->output = array_keys($tenants); + $this->output = $out; $this->error = PluginM365Error::ERROR_NO_ERRORS; } } diff --git a/gui/baculum/protected/API/openapi_baculum.json b/gui/baculum/protected/API/openapi_baculum.json index d020e023f..e0143e675 100644 --- a/gui/baculum/protected/API/openapi_baculum.json +++ b/gui/baculum/protected/API/openapi_baculum.json @@ -9229,21 +9229,28 @@ "/api/v2/plugins/m365/{clientid}/tenants": { "get": { "tags": ["plugins"], - "summary": "Microsoft 365 plugin tenant identifier list", - "description": "Get Microsoft 365 tenant identifier list.", + "summary": "Microsoft 365 plugin tenant identifier and name list", + "description": "Get Microsoft 365 tenant identifier and name list.", "responses": { "200": { - "description": "List of Microsoft 365 tenant identifiers.", + "description": "List of Microsoft 365 tenant identifiers with names.", "content": { "application/json": { "schema": { "type": "object", "properties": { "output": { - "type": "array", - "items": { - "type": "string", - "description": "Tenant identifier" + "type": "object", + "properties": { + "tenant_id": { + "type": "object", + "properties": { + "tenant_name": { + "type": "string", + "description": "Tenant name" + } + } + } } }, "error": {