Skip to content

Commit

Permalink
config: Allow to disable the Director UI
Browse files Browse the repository at this point in the history
fixes #2007
  • Loading branch information
Thomas-Gelf committed Oct 31, 2019
1 parent 3996efc commit bbe55f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions configuration.php
Expand Up @@ -3,6 +3,9 @@
use Icinga\Application\Icinga;
use Icinga\Web\Window;

if ($this->getConfig()->get('frontend', 'disabled', 'no') === 'yes') {
return;
}
$this->providePermission('director/api', $this->translate('Allow to access the director API'));
$this->providePermission('director/audit', $this->translate('Allow to access the full audit log'));
$this->providePermission(
Expand Down
1 change: 1 addition & 0 deletions doc/82-Changelog.md
Expand Up @@ -15,6 +15,7 @@ next (will be 1.8.0)
* FIX: It's now possible to set Endpoint ports > 32767 on PostgreSQL (#928)
* FEATURE: Data Fields can now be grouped into categories (#1969)
* FEATURE: Inspect is now available for Packages, Stages and Files (#1995)
* FEATURE: Allow to disable the Director frontend / UI (#2007)

1.7.2
-----
Expand Down
6 changes: 6 additions & 0 deletions library/Director/Web/Controller/ActionController.php
Expand Up @@ -4,6 +4,7 @@

use Icinga\Application\Benchmark;
use Icinga\Data\Paginatable;
use Icinga\Exception\NotFoundError;
use Icinga\Exception\ProgrammingError;
use Icinga\Module\Director\Monitoring;
use Icinga\Module\Director\Web\Controller\Extension\CoreApi;
Expand Down Expand Up @@ -44,6 +45,11 @@ abstract class ActionController extends Controller implements ControlsAndContent
*/
public function init()
{
if (! $this->getRequest()->isApiRequest()
&& $this->Config()->get('frontend', 'disabled', 'no') === 'yes'
) {
throw new NotFoundError('Not found');
}
$this->initializeTranslator();
Benchmark::measure('Director base Controller init()');
$this->checkForRestApiRequest();
Expand Down

0 comments on commit bbe55f2

Please sign in to comment.