Skip to content

Commit

Permalink
Fix saving config by set access button
Browse files Browse the repository at this point in the history
This bug has been reported by @ganiuszka in bacularis-app repository.

bacularis/bacularis-app#53
  • Loading branch information
ganiuszka committed Jun 14, 2024
1 parent ceb4664 commit 7b8478c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Web/Pages/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Bacularis\Common\Modules\AuthOAuth2;
use Bacularis\Common\Modules\AuthBasic;
use Bacularis\Common\Modules\AuditLog;
use Bacularis\Common\Modules\Errors\BaculaConfigError;
use Bacularis\Common\Modules\Ldap;
use Bacularis\Common\Modules\Logging;
use Bacularis\Web\Modules\BaculumWebPage;
Expand Down Expand Up @@ -2805,7 +2806,7 @@ private function setJobResourceAccess($api_host, $jobs)
}
}

$result = $this->getModule('api')->set([
$result = $this->getModule('api')->create([
'config',
'dir',
'Console',
Expand All @@ -2816,6 +2817,26 @@ private function setJobResourceAccess($api_host, $jobs)

if ($result->error === 0) {
$this->getModule('api')->set(['console'], ['reload']);
} elseif ($result->error === BaculaConfigError::ERROR_CONFIG_ALREADY_EXISTS) {
// Config exists, so try to update it
$result = $this->getModule('api')->set([
'config',
'dir',
'Console',
$acls['Name']
], [
'config' => json_encode($acls)
], $api_host);
if ($result->error === 0) {
$this->getModule('api')->set(['console'], ['reload']);
} else {
$cb->update(
'api_host_access_window_error',
$result->output
);
$cb->show('api_host_access_window_error');
return '';
}
} else {
$cb->update(
'api_host_access_window_error',
Expand Down

0 comments on commit 7b8478c

Please sign in to comment.