From: Marcin Haba Date: Sat, 12 Dec 2015 12:52:56 +0000 (+0100) Subject: baculum: Get job show result by job name or jobid X-Git-Tag: Release-7.4.0~147 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f867d2bf6e0b9e5bd5442ba3c7ef6e78029a1693;p=bacula%2Fbacula baculum: Get job show result by job name or jobid --- diff --git a/gui/baculum/protected/Pages/API/JobShow.php b/gui/baculum/protected/Pages/API/JobShow.php index fddd516c95..b378386f8b 100644 --- a/gui/baculum/protected/Pages/API/JobShow.php +++ b/gui/baculum/protected/Pages/API/JobShow.php @@ -22,10 +22,19 @@ class JobShow extends BaculumAPI { public function get() { - $jobid = intval($this->Request['id']); - $job = $this->getModule('job')->getJobById($jobid); - if(!is_null($job)) { - $jobShow = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'job="' . $job->name . '"'), $this->user); + $jobname = null; + + if (isset($this->Request['id'])) { + $jobid = intval($this->Request['id']); + $job = $this->getModule('job')->getJobById($jobid); + $jobname = property_exists($job, 'name') ? $job->name : null; + } elseif (isset($this->Request['name'])) { + $allowedJobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user)->output; + $jobname = in_array($this->Request['name'], $allowedJobs) ? $this->Request['name'] : null; + } + + if(!is_null($jobname)) { + $jobShow = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'job="' . $jobname . '"'), $this->user); $this->output = $jobShow->output; $this->error = (integer)$jobShow->exitcode; } else { diff --git a/gui/baculum/protected/application.xml b/gui/baculum/protected/application.xml index 99e3f67717..ad0e839f0d 100644 --- a/gui/baculum/protected/application.xml +++ b/gui/baculum/protected/application.xml @@ -65,6 +65,7 @@ +