IcingaHostSelfServiceForm: fail early if template

...is not for Agents
This commit is contained in:
Thomas Gelf 2017-07-21 15:46:33 +02:00
parent cd92429a60
commit ad791918bc
1 changed files with 7 additions and 0 deletions

View File

@ -71,6 +71,13 @@ class IcingaHostSelfServiceForm extends DirectorForm
throw new NotFoundError('Got invalid API key "%s"', $key);
}
if ($this->template->getResolvedProperty('has_agent') !== 'y') {
throw new NotFoundError(
'Got valid API key "%s", but template is not for Agents',
$key
);
}
$this->removeElement('key');
return $this->template;