diff --git a/app/modules/Api/actions/ApiCommandAction.class.php b/app/modules/Api/actions/ApiCommandAction.class.php index abd190bbe..ce8843bf4 100644 --- a/app/modules/Api/actions/ApiCommandAction.class.php +++ b/app/modules/Api/actions/ApiCommandAction.class.php @@ -36,15 +36,11 @@ public function executeWrite(AgaviRequestDataHolder $rd) { if (!$this->context->getUser()->isAuthenticated() || !$this->context->getUser()->hasCredential('icinga.user')) { return array('Api', 'GenericError'); } - try { - if($this->context->getUser()->getNsmUser()->getTarget('IcingaCommandRo')) { - $errors = array('Commands are disabled for this user'); - $this->getContainer()->setAttributeByRef('errors', $errors, 'org.icinga.api.auth'); - $this->getContainer()->setAttribute('success', false, 'org.icinga.api.auth'); - return array('Api', 'GenericError'); - } - } catch (AppKitDoctrineException $e) { - // PASS + if ($this->context->getUser()->getNsmUser()->getTarget('IcingaCommandRo')) { + $errors = array('Commands are disabled for this user'); + $this->getContainer()->setAttributeByRef('errors', $errors, 'org.icinga.api.auth'); + $this->getContainer()->setAttribute('success', false, 'org.icinga.api.auth'); + return array('Api', 'GenericError'); } $command = $rd->getParameter("command");