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] [localdb]
type = ido type = ido
host = localhost host = localhost
user = "icinga-idoutils" user = "icinga"
pass = "Secret" pass = "icinga"
db = "icinga" db = "icinga"
[locallive] [locallive]

View File

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

View File

@ -8,7 +8,7 @@ use Icinga\Authentication\User as User;
use Icinga\Authentication\UserBackend; use Icinga\Authentication\UserBackend;
use Icinga\Authentication\Credentials; use Icinga\Authentication\Credentials;
use Icinga\Protocol\Ldap; use Icinga\Protocol\Ldap;
use Icinga\Application\Config; use Icinga\Application\Config as IcingaConfig;
/** /**
* User authentication backend (@see Icinga\Authentication\UserBackend) for * User authentication backend (@see Icinga\Authentication\UserBackend) for
@ -70,16 +70,10 @@ class LdapUserBackend implements UserBackend
protected function selectUsername($username) protected function selectUsername($username)
{ {
return $this->connection->select() return $this->connection->select()
->from( ->from(IcingaConfig::getInstance()->authentication->users->user_class,
Config::getInstance()->authentication->users->user_class, array(IcingaConfig::getInstance()->authentication->users->user_name_attribute))
array( ->where(IcingaConfig::getInstance()->authentication->users->user_name_attribute,
Config::getInstance()->authentication->users->user_name_attribute $this->stripAsterisks($username));
)
)
->where(
Config::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()); Logger::info("Invalid credentials for user %s provided", $credentials->getUsername());
return false; return false;
} }
if ($persist == true) { if ($persist == true) {
$this->persistCurrentUser(); $this->persistCurrentUser();
$this->session->write(); $this->session->write();
@ -244,4 +244,9 @@ class Manager
{ {
return $this->user->getGroups(); return $this->user->getGroups();
} }
public function getSession()
{
return $this->session;
}
} }

View File

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

View File

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

View File

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

View File

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