config: Allow to disable the Director UI

fixes #2007
This commit is contained in:
Thomas Gelf 2019-10-31 15:43:44 +01:00
parent 3996efc3cf
commit bbe55f28b6
3 changed files with 10 additions and 0 deletions

View File

@ -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(

View File

@ -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
-----

View File

@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Web\Controller;
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;
@ -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();