From: Marcin Haba Date: Sat, 17 Apr 2021 15:47:14 +0000 (+0200) Subject: baculum: Use catalog access in changer listall endpoint only if it is configured... X-Git-Tag: Release-11.0.3~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=805be39a34120e210747af988060d3c9ff714086;p=thirdparty%2Fbacula.git baculum: Use catalog access in changer listall endpoint only if it is configured on API host --- diff --git a/gui/baculum/protected/API/Pages/API/ChangerListAll.php b/gui/baculum/protected/API/Pages/API/ChangerListAll.php index 876aea3e7..c7b1a19ae 100644 --- a/gui/baculum/protected/API/Pages/API/ChangerListAll.php +++ b/gui/baculum/protected/API/Pages/API/ChangerListAll.php @@ -59,7 +59,15 @@ class ChangerListAll extends BaculumAPIServer { private function parseListAll($device_name, $output) { $list = ['drives' => [], 'slots' => [], 'ie_slots' => []]; $drives = $this->getModule('device_config')->getChangerDrives($device_name); - $volumes = $this->getModule('volume')->getVolumesKeys(); + $volumes = []; + $db_params = $this->getModule('api_config')->getConfig('db'); + if (key_exists('enabled', $db_params) && $db_params['enabled'] == 1) { + /** + * Volume information is provided only if on API host with autochanger + * enabled is access to the Catalog database for the API instance. + */ + $volumes = $this->getModule('volume')->getVolumesKeys(); + } $get_volume_info = function($volname) use ($volumes) { $volume = [ 'mediaid' => 0,