Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Removed unnecessary try/catch block on ApiCommand.
Browse files Browse the repository at this point in the history
Adopted from GitHub pull request ##1

Fixes #5465
Refs #5013
  • Loading branch information
lazyfrosch committed Feb 18, 2014
1 parent 2aabafa commit fd76752
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/modules/Api/actions/ApiCommandAction.class.php
Expand Up @@ -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");

Expand Down

0 comments on commit fd76752

Please sign in to comment.