From 07849e0fea0be6949f192ea0d874d21764c74800 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 28 Jul 2015 17:08:55 +0200 Subject: [PATCH] lib: Rename Authentication/Manager to Authentication/Auth refs #9660 --- application/forms/PreferenceForm.php | 4 ++-- application/layouts/scripts/body.phtml | 2 +- library/Icinga/Application/Web.php | 8 ++++---- library/Icinga/Authentication/{Manager.php => Auth.php} | 4 ++-- library/Icinga/Web/Controller/ActionController.php | 8 ++++---- library/Icinga/Web/Form.php | 8 ++++---- library/Icinga/Web/Menu.php | 6 +++--- library/Icinga/Web/Menu/PermittedMenuItemFilter.php | 4 ++-- library/Icinga/Web/View.php | 8 ++++---- library/Icinga/Web/View/helpers/generic.php | 4 ++-- .../Monitoring/Web/Menu/MonitoringMenuItemRenderer.php | 4 ++-- 11 files changed, 30 insertions(+), 30 deletions(-) rename library/Icinga/Authentication/{Manager.php => Auth.php} (99%) diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index 409feb751..b329ae1d4 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -6,7 +6,7 @@ namespace Icinga\Forms; use Exception; use DateTimeZone; use Icinga\Application\Logger; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\User\Preferences; use Icinga\User\Preferences\PreferencesStore; use Icinga\Util\TimezoneDetect; @@ -123,7 +123,7 @@ class PreferenceForm extends Form */ public function onRequest() { - $auth = Manager::getInstance(); + $auth = Auth::getInstance(); $values = $auth->getUser()->getPreferences()->get('icingaweb'); if (! isset($values['language'])) { diff --git a/application/layouts/scripts/body.phtml b/application/layouts/scripts/body.phtml index 5da1e4322..0fa60b284 100644 --- a/application/layouts/scripts/body.phtml +++ b/application/layouts/scripts/body.phtml @@ -2,7 +2,7 @@ use Icinga\Web\Url; use Icinga\Web\Notification; -use Icinga\Authentication\Manager as Auth; +use Icinga\Authentication\Auth; if (Auth::getInstance()->isAuthenticated()): diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 0add09089..1bc524726 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -12,7 +12,7 @@ use Zend_Layout; use Zend_Paginator; use Zend_View_Helper_PaginationControl; use Icinga\Application\Logger; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\User; use Icinga\Util\TimezoneDetect; use Icinga\Util\Translator; @@ -179,7 +179,7 @@ class Web extends ApplicationBootstrap */ private function setupUser() { - $auth = Manager::getInstance(); + $auth = Auth::getInstance(); if ($auth->isAuthenticated()) { $this->user = $auth->getUser(); } @@ -282,7 +282,7 @@ class Web extends ApplicationBootstrap */ protected function detectTimezone() { - $auth = Manager::getInstance(); + $auth = Auth::getInstance(); if (! $auth->isAuthenticated() || ($timezone = $auth->getUser()->getPreferences()->getValue('icingaweb', 'timezone')) === null ) { @@ -303,7 +303,7 @@ class Web extends ApplicationBootstrap */ protected function detectLocale() { - $auth = Manager::getInstance(); + $auth = Auth::getInstance(); if ($auth->isAuthenticated() && ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) !== null ) { diff --git a/library/Icinga/Authentication/Manager.php b/library/Icinga/Authentication/Auth.php similarity index 99% rename from library/Icinga/Authentication/Manager.php rename to library/Icinga/Authentication/Auth.php index 01173330a..c68f4cd80 100644 --- a/library/Icinga/Authentication/Manager.php +++ b/library/Icinga/Authentication/Auth.php @@ -15,7 +15,7 @@ use Icinga\User\Preferences; use Icinga\User\Preferences\PreferencesStore; use Icinga\Web\Session; -class Manager +class Auth { /** * Singleton instance @@ -44,7 +44,7 @@ class Manager public static function getInstance() { if (self::$instance === null) { - self::$instance = new static(); + self::$instance = new self(); } return self::$instance; } diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 2c4373a5c..c98a20a69 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -6,7 +6,7 @@ namespace Icinga\Web\Controller; use Exception; use Icinga\Application\Benchmark; use Icinga\Application\Config; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\Exception\Http\HttpMethodNotAllowedException; use Icinga\Exception\IcingaException; use Icinga\Exception\ProgrammingError; @@ -52,7 +52,7 @@ class ActionController extends Zend_Controller_Action /** * Authentication manager * - * @var Manager|null + * @var Auth|null */ private $auth; @@ -124,12 +124,12 @@ class ActionController extends Zend_Controller_Action /** * Get the authentication manager * - * @return Manager + * @return Auth */ public function Auth() { if ($this->auth === null) { - $this->auth = Manager::getInstance(); + $this->auth = Auth::getInstance(); } return $this->auth; } diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index 46c661405..626ac49af 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -8,7 +8,7 @@ use Zend_Form; use Zend_Form_Element; use Zend_View_Interface; use Icinga\Application\Icinga; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\Exception\ProgrammingError; use Icinga\Security\SecurityException; use Icinga\Util\Translator; @@ -179,7 +179,7 @@ class Form extends Zend_Form /** * Authentication manager * - * @var Manager|null + * @var Auth|null */ private $auth; @@ -1344,12 +1344,12 @@ class Form extends Zend_Form /** * Get the authentication manager * - * @return Manager + * @return Auth */ public function Auth() { if ($this->auth === null) { - $this->auth = Manager::getInstance(); + $this->auth = Auth::getInstance(); } return $this->auth; } diff --git a/library/Icinga/Web/Menu.php b/library/Icinga/Web/Menu.php index 9b62afbdd..3ad8d347f 100644 --- a/library/Icinga/Web/Menu.php +++ b/library/Icinga/Web/Menu.php @@ -7,7 +7,7 @@ use RecursiveIterator; use Icinga\Application\Config; use Icinga\Application\Icinga; use Icinga\Application\Logger; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\Data\ConfigObject; use Icinga\Exception\ConfigurationError; use Icinga\Exception\ProgrammingError; @@ -208,7 +208,7 @@ class Menu implements RecursiveIterator { $menu = new static('menu'); $menu->addMainMenuItems(); - $auth = Manager::getInstance(); + $auth = Auth::getInstance(); $manager = Icinga::app()->getModuleManager(); foreach ($manager->getLoadedModules() as $module) { if ($auth->hasPermission($manager::MODULE_PERMISSION_NS . $module->getName())) { @@ -223,7 +223,7 @@ class Menu implements RecursiveIterator */ protected function addMainMenuItems() { - $auth = Manager::getInstance(); + $auth = Auth::getInstance(); if ($auth->isAuthenticated()) { diff --git a/library/Icinga/Web/Menu/PermittedMenuItemFilter.php b/library/Icinga/Web/Menu/PermittedMenuItemFilter.php index 7224c3589..829506c0b 100644 --- a/library/Icinga/Web/Menu/PermittedMenuItemFilter.php +++ b/library/Icinga/Web/Menu/PermittedMenuItemFilter.php @@ -3,7 +3,7 @@ namespace Icinga\Web\Menu; use RecursiveFilterIterator; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\Web\Menu; class PermittedMenuItemFilter extends RecursiveFilterIterator @@ -18,7 +18,7 @@ class PermittedMenuItemFilter extends RecursiveFilterIterator $item = $this->current(); /** @var Menu $item */ if (($permission = $item->getPermission()) !== null) { - $auth = Manager::getInstance(); + $auth = Auth::getInstance(); if (! $auth->isAuthenticated()) { // Don't accept menu item because user is not authenticated and the menu item requires a permission return false; diff --git a/library/Icinga/Web/View.php b/library/Icinga/Web/View.php index 79f6f7d70..766516768 100644 --- a/library/Icinga/Web/View.php +++ b/library/Icinga/Web/View.php @@ -5,7 +5,7 @@ namespace Icinga\Web; use Closure; use Zend_View_Abstract; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\Exception\ProgrammingError; use Icinga\Util\Translator; @@ -39,7 +39,7 @@ class View extends Zend_View_Abstract /** * Authentication manager * - * @var \Icinga\Authentication\Manager|null + * @var Auth|null */ private $auth; @@ -164,12 +164,12 @@ class View extends Zend_View_Abstract /** * Get the authentication manager * - * @return Manager + * @return Auth */ public function Auth() { if ($this->auth === null) { - $this->auth = Manager::getInstance(); + $this->auth = Auth::getInstance(); } return $this->auth; } diff --git a/library/Icinga/Web/View/helpers/generic.php b/library/Icinga/Web/View/helpers/generic.php index 08d1e2130..59fa90443 100644 --- a/library/Icinga/Web/View/helpers/generic.php +++ b/library/Icinga/Web/View/helpers/generic.php @@ -3,11 +3,11 @@ namespace Icinga\Web\View; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\Web\Widget; $this->addHelperFunction('auth', function () { - return Manager::getInstance(); + return Auth::getInstance(); }); $this->addHelperFunction('widget', function ($name, $options = null) { diff --git a/modules/monitoring/library/Monitoring/Web/Menu/MonitoringMenuItemRenderer.php b/modules/monitoring/library/Monitoring/Web/Menu/MonitoringMenuItemRenderer.php index 132012ba9..df901b165 100644 --- a/modules/monitoring/library/Monitoring/Web/Menu/MonitoringMenuItemRenderer.php +++ b/modules/monitoring/library/Monitoring/Web/Menu/MonitoringMenuItemRenderer.php @@ -3,7 +3,7 @@ namespace Icinga\Module\Monitoring\Web\Menu; -use Icinga\Authentication\Manager; +use Icinga\Authentication\Auth; use Icinga\Data\Filter\Filter; use Icinga\Data\Filterable; use Icinga\Web\Menu; @@ -27,7 +27,7 @@ class MonitoringMenuItemRenderer extends MenuItemRenderer protected static function applyRestriction($restriction, Filterable $filterable) { $restrictions = Filter::matchAny(); - foreach (Manager::getInstance()->getRestrictions($restriction) as $filter) { + foreach (Auth::getInstance()->getRestrictions($restriction) as $filter) { $restrictions->addFilter(Filter::fromQueryString($filter)); } $filterable->applyFilter($restrictions);