[icinga-checkins] icinga.org: icingaweb2/master: Security: Remove obsolete actions

git at icinga.org git at icinga.org
Wed Nov 19 16:31:56 CET 2014


Module: icingaweb2
Branch: master
Commit: f0084542e64936a76bf401e712561ab740965c72
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=f0084542e64936a76bf401e712561ab740965c72

Author: Eric Lippmann <eric.lippmann at netways.de>
Date:   Wed Nov 19 14:44:28 2014 +0100

Security: Remove obsolete actions

refs #5647

---

 application/controllers/SecurityController.php |  114 ------------------------
 1 file changed, 114 deletions(-)

diff --git a/application/controllers/SecurityController.php b/application/controllers/SecurityController.php
index 57f2285..5648837 100644
--- a/application/controllers/SecurityController.php
+++ b/application/controllers/SecurityController.php
@@ -4,12 +4,9 @@
 
 use Icinga\Application\Config;
 use Icinga\Forms\ConfirmRemovalForm;
-use Icinga\Forms\Security\PermissionForm;
-use Icinga\Forms\Security\RestrictionForm;
 use Icinga\Forms\Security\RoleForm;
 use Icinga\Web\Controller\ActionController;
 use Icinga\Web\Notification;
-use Icinga\Web\Request;
 
 class SecurityController extends ActionController
 {
@@ -131,115 +128,4 @@ class SecurityController extends ActionController
         $this->view->name = $name;
         $this->view->form = $confirmation;
     }
-
-    public function newRestrictionAction()
-    {
-        $restriction = new RestrictionForm(array(
-            'onSuccess' => function (Request $request, RestrictionForm $restriction) {
-                $name = $restriction->getElement('name')->getValue();
-                $values = $restriction->getValues();
-                try {
-                    $restriction->add($name, $values);
-                } catch (InvalidArgumentException $e) {
-                    $restriction->addError($e->getMessage());
-                    return false;
-                }
-                if ($restriction->save()) {
-                    Notification::success(t('Restriction set'));
-                    return true;
-                }
-                return false;
-            }
-        ));
-        $restriction
-            ->setIniConfig(Config::app('restrictions', true))
-            ->setRedirectUrl('security')
-            ->handleRequest();
-        $this->view->form = $restriction;
-    }
-
-    public function updateRestrictionAction()
-    {
-        $name = $this->_request->getParam('restriction');
-        if (empty($name)) {
-            throw new Zend_Controller_Action_Exception(
-                sprintf($this->translate('Required parameter \'%s\' missing'), 'restriction'),
-                400
-            );
-        }
-        $restriction = new RestrictionForm();
-        try {
-            $restriction
-                ->setIniConfig(Config::app('restrictions', true))
-                ->load($name);
-        } catch (InvalidArgumentException $e) {
-            throw new Zend_Controller_Action_Exception(
-                $e->getMessage(),
-                400
-            );
-        }
-        $restriction
-            ->setOnSuccess(function (Request $request, RestrictionForm $restriction) use ($name) {
-                $oldName = $name;
-                $name = $restriction->getElement('name')->getValue();
-                $values = $restriction->getValues();
-                try {
-                    $restriction->update($name, $values, $oldName);
-                } catch (InvalidArgumentException $e) {
-                    $restriction->addError($e->getMessage());
-                    return false;
-                }
-                if ($restriction->save()) {
-                    Notification::success(t('Restriction set'));
-                    return true;
-                }
-                return false;
-            })
-            ->setRedirectUrl('security')
-            ->handleRequest();
-        $this->view->name = $name;
-        $this->view->form = $restriction;
-    }
-
-    public function removeRestrictionAction()
-    {
-        $name = $this->_request->getParam('restriction');
-        if (empty($name)) {
-            throw new Zend_Controller_Action_Exception(
-                sprintf($this->translate('Required parameter \'%s\' missing'), 'restriction'),
-                400
-            );
-        }
-        $restriction = new RestrictionForm();
-        try {
-            $restriction
-                ->setIniConfig(Config::app('restrictions', true))
-                ->load($name);
-        } catch (InvalidArgumentException $e) {
-            throw new Zend_Controller_Action_Exception(
-                $e->getMessage(),
-                400
-            );
-        }
-        $confirmation = new ConfirmRemovalForm(array(
-            'onSuccess' => function (Request $request, ConfirmRemovalForm $confirmation) use ($name, $restriction) {
-                try {
-                    $restriction->remove($name);
-                } catch (InvalidArgumentException $e) {
-                    Notification::error($e->getMessage());
-                    return false;
-                }
-                if ($restriction->save()) {
-                    Notification::success(sprintf(t('Restriction \'%s\' has been successfully removed'), $name));
-                    return true;
-                }
-                return false;
-            }
-        ));
-        $confirmation
-            ->setRedirectUrl('security')
-            ->handleRequest();
-        $this->view->name = $name;
-        $this->view->form = $confirmation;
-    }
 }



More information about the icinga-checkins mailing list