mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-21 21:04:25 +02:00
parent
8797d3e095
commit
ed53ab6c9d
@ -18,7 +18,7 @@ class LdapUserBackend implements UserBackend
|
|||||||
|
|
||||||
public function hasUsername($username)
|
public function hasUsername($username)
|
||||||
{
|
{
|
||||||
if (! $username) {
|
if (!$username) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->connection->fetchOne(
|
return $this->connection->fetchOne(
|
||||||
@ -43,13 +43,15 @@ class LdapUserBackend implements UserBackend
|
|||||||
if (empty($username) || empty($password)) {
|
if (empty($username) || empty($password)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (! $this->connection->testCredentials(
|
|
||||||
|
if (!$this->connection->testCredentials(
|
||||||
$this->connection->fetchDN($this->selectUsername($username)),
|
$this->connection->fetchDN($this->selectUsername($username)),
|
||||||
$password
|
$password
|
||||||
)) {
|
) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$user = new User($username);
|
$user = new User($username);
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
namespace Icinga\Authentication;
|
namespace Icinga\Authentication;
|
||||||
|
|
||||||
|
|
||||||
class Credentials
|
class Credentials
|
||||||
{
|
{
|
||||||
protected $username;
|
protected $username;
|
||||||
|
@ -7,15 +7,18 @@ namespace Icinga\Authentication;
|
|||||||
use Icinga\Application\Logger as Logger;
|
use Icinga\Application\Logger as Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard PHP Session handling
|
* Class PhpSession
|
||||||
* You have to call read() first in order to start the session. If
|
*
|
||||||
* no parameter is given to read, the session is closed immediately
|
* Standard PHP Session handling
|
||||||
* after reading the persisted variables, in order to avoid concurrent
|
* You have to call read() first in order to start the session. If
|
||||||
* requests to be blocked. Otherwise, you can call write() (again with
|
* no parameter is given to read, the session is closed immediately
|
||||||
* no parameter in order to auto-close it) to persist all values previously
|
* after reading the persisted variables, in order to avoid concurrent
|
||||||
* set with the set() method
|
* requests to be blocked. Otherwise, you can call write() (again with
|
||||||
*
|
* no parameter in order to auto-close it) to persist all values previously
|
||||||
**/
|
* set with the set() method
|
||||||
|
*
|
||||||
|
* @package Icinga\Authentication
|
||||||
|
*/
|
||||||
class PhpSession extends Session
|
class PhpSession extends Session
|
||||||
{
|
{
|
||||||
const SESSION_NAME = "Icinga2Web";
|
const SESSION_NAME = "Icinga2Web";
|
||||||
@ -32,7 +35,6 @@ class PhpSession extends Session
|
|||||||
'hash_bits_per_character' => 5,
|
'hash_bits_per_character' => 5,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public function __construct(array $options = null)
|
public function __construct(array $options = null)
|
||||||
{
|
{
|
||||||
if ($options !== null) {
|
if ($options !== null) {
|
||||||
@ -114,9 +116,11 @@ class PhpSession extends Session
|
|||||||
$_SESSION[$key] = $value;
|
$_SESSION[$key] = $value;
|
||||||
}
|
}
|
||||||
if ($keepOpen) {
|
if ($keepOpen) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
$this->close();
|
$this->close();
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close()
|
public function close()
|
||||||
|
@ -8,7 +8,6 @@ abstract class Session
|
|||||||
{
|
{
|
||||||
private $sessionValues = array();
|
private $sessionValues = array();
|
||||||
|
|
||||||
|
|
||||||
abstract public function open();
|
abstract public function open();
|
||||||
abstract public function read($keepOpen = false);
|
abstract public function read($keepOpen = false);
|
||||||
abstract public function write($keepOpen = false);
|
abstract public function write($keepOpen = false);
|
||||||
|
@ -30,13 +30,22 @@ class User
|
|||||||
private $permissions = array();
|
private $permissions = array();
|
||||||
private $groups = array();
|
private $groups = array();
|
||||||
|
|
||||||
public function __construct($username, $firstname, $lastname, $email)
|
public function __construct($username, $firstname = null, $lastname = null, $email = null)
|
||||||
{
|
{
|
||||||
$this->setUsername($username);
|
$this->setUsername($username);
|
||||||
|
|
||||||
|
if ($firstname !== null) {
|
||||||
$this->setFirstname($firstname);
|
$this->setFirstname($firstname);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($lastname !== null) {
|
||||||
$this->setLastname($lastname);
|
$this->setLastname($lastname);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($email !== null) {
|
||||||
$this->setEmail($email);
|
$this->setEmail($email);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getGroups()
|
public function getGroups()
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,10 @@ require_once("../../library/Icinga/Protocol/Statusdat/Reader.php");
|
|||||||
require_once("../../library/Icinga/Exception/ConfigurationError.php");
|
require_once("../../library/Icinga/Exception/ConfigurationError.php");
|
||||||
|
|
||||||
use Icinga\Protocol\Statusdat\Reader as Reader;
|
use Icinga\Protocol\Statusdat\Reader as Reader;
|
||||||
define("APPLICATION_PATH","./"); // TODO: test boostrap
|
|
||||||
|
if (!defined('APPLICATION_PATH')) {
|
||||||
|
define("APPLICATION_PATH","./"); // TODO: test boostrap
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Test class for Reader
|
* Test class for Reader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user