Fix use of already replaced class Icinga\Web\Session

refs #4301
This commit is contained in:
Eric Lippmann 2013-06-27 13:04:47 +02:00
parent 658fbd0584
commit 6eade9c023
8 changed files with 25 additions and 27 deletions

View File

@ -1,8 +1,8 @@
[localdb]
type = ido
host = localhost
user = "icinga-idoutils"
pass = "Secret"
user = "icinga"
pass = "icinga"
db = "icinga"
[locallive]

View File

@ -5,7 +5,6 @@
namespace Icinga\Application;
use Icinga\Authentication\Manager;
use Icinga\Web\Session;
use Zend_Controller_Front as FrontController;
use Zend_Layout as Layout;
use Zend_Paginator as Paginator;
@ -93,7 +92,7 @@ class Web extends ApplicationBootstrap
protected function loadTranslations()
{
// Session::getInstance()->language;
// AuthManager::getInstance()->getSession()->language;
$locale = null;
if (!$locale) {
$locale = 'en_US';
@ -107,7 +106,7 @@ class Web extends ApplicationBootstrap
protected function dispatchFrontController()
{
// Session::getInstance();
// AuthManager::getInstance()->getSession();
$this->frontController->dispatch();
return $this;
}

View File

@ -8,7 +8,7 @@ use Icinga\Authentication\User as User;
use Icinga\Authentication\UserBackend;
use Icinga\Authentication\Credentials;
use Icinga\Protocol\Ldap;
use Icinga\Application\Config;
use Icinga\Application\Config as IcingaConfig;
/**
* User authentication backend (@see Icinga\Authentication\UserBackend) for
@ -70,16 +70,10 @@ class LdapUserBackend implements UserBackend
protected function selectUsername($username)
{
return $this->connection->select()
->from(
Config::getInstance()->authentication->users->user_class,
array(
Config::getInstance()->authentication->users->user_name_attribute
)
)
->where(
Config::getInstance()->authentication->users->user_name_attribute,
$this->stripAsterisks($username)
);
->from(IcingaConfig::getInstance()->authentication->users->user_class,
array(IcingaConfig::getInstance()->authentication->users->user_name_attribute))
->where(IcingaConfig::getInstance()->authentication->users->user_name_attribute,
$this->stripAsterisks($username));
}
/**

View File

@ -176,7 +176,7 @@ class Manager
Logger::info("Invalid credentials for user %s provided", $credentials->getUsername());
return false;
}
if ($persist == true) {
$this->persistCurrentUser();
$this->session->write();
@ -244,4 +244,9 @@ class Manager
{
return $this->user->getGroups();
}
public function getSession()
{
return $this->session;
}
}

View File

@ -1,12 +1,14 @@
<?php
namespace Icinga;
use Icinga\Application\Config;
use Icinga\Web\Session;
use Icinga\Authentication\Manager as AuthManager;
class Backend
{
protected static $instances = array();
protected function __construct() {}
public static function getInstance($name = null)
@ -14,7 +16,7 @@ class Backend
if (! array_key_exists($name, self::$instances)) {
$config = Config::getInstance()->backends;
if ($name === null) {
$name = Session::getInstance()->backend;
$name = AuthManager::getInstance()->getSession()->get('backend');
}
if ($name === null) {
$name = array_shift(array_keys($config->toArray()));

View File

@ -2,8 +2,8 @@
[localdb]
type = ido
host = localhost
user = "icinga-idoutils"
pass = "***"
user = "icinga"
pass = "icinga"
db = "icinga"

View File

@ -3,14 +3,14 @@
namespace Icinga\Monitoring;
use Icinga\Application\Config;
use Icinga\Web\Session;
use Icinga\Authentication\Manager as AuthManager;
use Exception;
class Backend
{
protected static $instances = array();
protected static $backendConfigs;
final protected function __construct()
{
}
@ -76,7 +76,7 @@ class Backend
} else {
if ($name === null) {
// TODO: Remove this, will be chosen by Environment
$name = Session::getInstance()->backend;
$name = AuthManager::getInstance()->getSession()->get('backend');
}
return self::getBackend($name);
}

View File

@ -3,8 +3,6 @@
namespace Icinga\Monitoring;
use Icinga\Application\Config;
use Icinga\Web\Session;
use Exception;
class Environment
{