lib: Rename Authentication/Manager to Authentication/Auth

refs #9660
This commit is contained in:
Eric Lippmann 2015-07-28 17:08:55 +02:00
parent 40d31d02bd
commit 07849e0fea
11 changed files with 30 additions and 30 deletions

View File

@ -6,7 +6,7 @@ namespace Icinga\Forms;
use Exception; use Exception;
use DateTimeZone; use DateTimeZone;
use Icinga\Application\Logger; use Icinga\Application\Logger;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\User\Preferences; use Icinga\User\Preferences;
use Icinga\User\Preferences\PreferencesStore; use Icinga\User\Preferences\PreferencesStore;
use Icinga\Util\TimezoneDetect; use Icinga\Util\TimezoneDetect;
@ -123,7 +123,7 @@ class PreferenceForm extends Form
*/ */
public function onRequest() public function onRequest()
{ {
$auth = Manager::getInstance(); $auth = Auth::getInstance();
$values = $auth->getUser()->getPreferences()->get('icingaweb'); $values = $auth->getUser()->getPreferences()->get('icingaweb');
if (! isset($values['language'])) { if (! isset($values['language'])) {

View File

@ -2,7 +2,7 @@
use Icinga\Web\Url; use Icinga\Web\Url;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Authentication\Manager as Auth; use Icinga\Authentication\Auth;
if (Auth::getInstance()->isAuthenticated()): if (Auth::getInstance()->isAuthenticated()):

View File

@ -12,7 +12,7 @@ use Zend_Layout;
use Zend_Paginator; use Zend_Paginator;
use Zend_View_Helper_PaginationControl; use Zend_View_Helper_PaginationControl;
use Icinga\Application\Logger; use Icinga\Application\Logger;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\User; use Icinga\User;
use Icinga\Util\TimezoneDetect; use Icinga\Util\TimezoneDetect;
use Icinga\Util\Translator; use Icinga\Util\Translator;
@ -179,7 +179,7 @@ class Web extends ApplicationBootstrap
*/ */
private function setupUser() private function setupUser()
{ {
$auth = Manager::getInstance(); $auth = Auth::getInstance();
if ($auth->isAuthenticated()) { if ($auth->isAuthenticated()) {
$this->user = $auth->getUser(); $this->user = $auth->getUser();
} }
@ -282,7 +282,7 @@ class Web extends ApplicationBootstrap
*/ */
protected function detectTimezone() protected function detectTimezone()
{ {
$auth = Manager::getInstance(); $auth = Auth::getInstance();
if (! $auth->isAuthenticated() if (! $auth->isAuthenticated()
|| ($timezone = $auth->getUser()->getPreferences()->getValue('icingaweb', 'timezone')) === null || ($timezone = $auth->getUser()->getPreferences()->getValue('icingaweb', 'timezone')) === null
) { ) {
@ -303,7 +303,7 @@ class Web extends ApplicationBootstrap
*/ */
protected function detectLocale() protected function detectLocale()
{ {
$auth = Manager::getInstance(); $auth = Auth::getInstance();
if ($auth->isAuthenticated() if ($auth->isAuthenticated()
&& ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) !== null && ($locale = $auth->getUser()->getPreferences()->getValue('icingaweb', 'language')) !== null
) { ) {

View File

@ -15,7 +15,7 @@ use Icinga\User\Preferences;
use Icinga\User\Preferences\PreferencesStore; use Icinga\User\Preferences\PreferencesStore;
use Icinga\Web\Session; use Icinga\Web\Session;
class Manager class Auth
{ {
/** /**
* Singleton instance * Singleton instance
@ -44,7 +44,7 @@ class Manager
public static function getInstance() public static function getInstance()
{ {
if (self::$instance === null) { if (self::$instance === null) {
self::$instance = new static(); self::$instance = new self();
} }
return self::$instance; return self::$instance;
} }

View File

@ -6,7 +6,7 @@ namespace Icinga\Web\Controller;
use Exception; use Exception;
use Icinga\Application\Benchmark; use Icinga\Application\Benchmark;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\Exception\Http\HttpMethodNotAllowedException; use Icinga\Exception\Http\HttpMethodNotAllowedException;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
@ -52,7 +52,7 @@ class ActionController extends Zend_Controller_Action
/** /**
* Authentication manager * Authentication manager
* *
* @var Manager|null * @var Auth|null
*/ */
private $auth; private $auth;
@ -124,12 +124,12 @@ class ActionController extends Zend_Controller_Action
/** /**
* Get the authentication manager * Get the authentication manager
* *
* @return Manager * @return Auth
*/ */
public function Auth() public function Auth()
{ {
if ($this->auth === null) { if ($this->auth === null) {
$this->auth = Manager::getInstance(); $this->auth = Auth::getInstance();
} }
return $this->auth; return $this->auth;
} }

View File

@ -8,7 +8,7 @@ use Zend_Form;
use Zend_Form_Element; use Zend_Form_Element;
use Zend_View_Interface; use Zend_View_Interface;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Security\SecurityException; use Icinga\Security\SecurityException;
use Icinga\Util\Translator; use Icinga\Util\Translator;
@ -179,7 +179,7 @@ class Form extends Zend_Form
/** /**
* Authentication manager * Authentication manager
* *
* @var Manager|null * @var Auth|null
*/ */
private $auth; private $auth;
@ -1344,12 +1344,12 @@ class Form extends Zend_Form
/** /**
* Get the authentication manager * Get the authentication manager
* *
* @return Manager * @return Auth
*/ */
public function Auth() public function Auth()
{ {
if ($this->auth === null) { if ($this->auth === null) {
$this->auth = Manager::getInstance(); $this->auth = Auth::getInstance();
} }
return $this->auth; return $this->auth;
} }

View File

@ -7,7 +7,7 @@ use RecursiveIterator;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Application\Logger; use Icinga\Application\Logger;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\Data\ConfigObject; use Icinga\Data\ConfigObject;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
@ -208,7 +208,7 @@ class Menu implements RecursiveIterator
{ {
$menu = new static('menu'); $menu = new static('menu');
$menu->addMainMenuItems(); $menu->addMainMenuItems();
$auth = Manager::getInstance(); $auth = Auth::getInstance();
$manager = Icinga::app()->getModuleManager(); $manager = Icinga::app()->getModuleManager();
foreach ($manager->getLoadedModules() as $module) { foreach ($manager->getLoadedModules() as $module) {
if ($auth->hasPermission($manager::MODULE_PERMISSION_NS . $module->getName())) { if ($auth->hasPermission($manager::MODULE_PERMISSION_NS . $module->getName())) {
@ -223,7 +223,7 @@ class Menu implements RecursiveIterator
*/ */
protected function addMainMenuItems() protected function addMainMenuItems()
{ {
$auth = Manager::getInstance(); $auth = Auth::getInstance();
if ($auth->isAuthenticated()) { if ($auth->isAuthenticated()) {

View File

@ -3,7 +3,7 @@
namespace Icinga\Web\Menu; namespace Icinga\Web\Menu;
use RecursiveFilterIterator; use RecursiveFilterIterator;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\Web\Menu; use Icinga\Web\Menu;
class PermittedMenuItemFilter extends RecursiveFilterIterator class PermittedMenuItemFilter extends RecursiveFilterIterator
@ -18,7 +18,7 @@ class PermittedMenuItemFilter extends RecursiveFilterIterator
$item = $this->current(); $item = $this->current();
/** @var Menu $item */ /** @var Menu $item */
if (($permission = $item->getPermission()) !== null) { if (($permission = $item->getPermission()) !== null) {
$auth = Manager::getInstance(); $auth = Auth::getInstance();
if (! $auth->isAuthenticated()) { if (! $auth->isAuthenticated()) {
// Don't accept menu item because user is not authenticated and the menu item requires a permission // Don't accept menu item because user is not authenticated and the menu item requires a permission
return false; return false;

View File

@ -5,7 +5,7 @@ namespace Icinga\Web;
use Closure; use Closure;
use Zend_View_Abstract; use Zend_View_Abstract;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Util\Translator; use Icinga\Util\Translator;
@ -39,7 +39,7 @@ class View extends Zend_View_Abstract
/** /**
* Authentication manager * Authentication manager
* *
* @var \Icinga\Authentication\Manager|null * @var Auth|null
*/ */
private $auth; private $auth;
@ -164,12 +164,12 @@ class View extends Zend_View_Abstract
/** /**
* Get the authentication manager * Get the authentication manager
* *
* @return Manager * @return Auth
*/ */
public function Auth() public function Auth()
{ {
if ($this->auth === null) { if ($this->auth === null) {
$this->auth = Manager::getInstance(); $this->auth = Auth::getInstance();
} }
return $this->auth; return $this->auth;
} }

View File

@ -3,11 +3,11 @@
namespace Icinga\Web\View; namespace Icinga\Web\View;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\Web\Widget; use Icinga\Web\Widget;
$this->addHelperFunction('auth', function () { $this->addHelperFunction('auth', function () {
return Manager::getInstance(); return Auth::getInstance();
}); });
$this->addHelperFunction('widget', function ($name, $options = null) { $this->addHelperFunction('widget', function ($name, $options = null) {

View File

@ -3,7 +3,7 @@
namespace Icinga\Module\Monitoring\Web\Menu; namespace Icinga\Module\Monitoring\Web\Menu;
use Icinga\Authentication\Manager; use Icinga\Authentication\Auth;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
use Icinga\Data\Filterable; use Icinga\Data\Filterable;
use Icinga\Web\Menu; use Icinga\Web\Menu;
@ -27,7 +27,7 @@ class MonitoringMenuItemRenderer extends MenuItemRenderer
protected static function applyRestriction($restriction, Filterable $filterable) protected static function applyRestriction($restriction, Filterable $filterable)
{ {
$restrictions = Filter::matchAny(); $restrictions = Filter::matchAny();
foreach (Manager::getInstance()->getRestrictions($restriction) as $filter) { foreach (Auth::getInstance()->getRestrictions($restriction) as $filter) {
$restrictions->addFilter(Filter::fromQueryString($filter)); $restrictions->addFilter(Filter::fromQueryString($filter));
} }
$filterable->applyFilter($restrictions); $filterable->applyFilter($restrictions);