ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAuthContainerDatabase.php
Go to the documentation of this file.
1<?php
2// BEGIN WebDAV: Strip Microsoft Domain Names from logins
3require_once 'Auth/Container.php';
4require_once 'Auth/Container/MDB2.php';
5
28{
37
39 {
41 }
42
43 function getUser($username)
44 {
46
47 // Fetch the data
48 return parent::getUser($username);
49 }
50
51 function fetchData($username, $password, $isChallengeResponse=false)
52 {
54
55 $isSuccessful = parent::fetchData($username, $password, $isChallengeResponse);
56 if ($this->isObserversEnabled)
57 {
58 if ($isSuccessful)
59 {
60 $this->loginObserver($username);
61 }
62 else
63 {
64 $this->failedLoginObserver();
65 }
66 }
67 return $isSuccessful;
68 }
69
73 static function toUsernameWithoutDomain($username)
74 {
75 // Remove all characters including the last slash or the last backslash
76 // in the username
77 $pos = strrpos($username, '/');
78 $pos2 = strrpos($username, '\\');
79 if ($pos === false || $pos < $pos2)
80 {
81 $pos = $pos2;
82 }
83 if ($pos !== false)
84 {
85 $username = substr($username, $pos + 1);
86 }
87 return $username;
88 }
89
93 public function setObserversEnabled($boolean)
94 {
95 $this->isObserversEnabled = $boolean;
96 }
97
101 public function isObserversEnabled()
102 {
104 }
105
106
112 public function loginObserver($a_username)
113 {
114 global $ilLog;
115 $ilLog->write(__METHOD__.': logged in as '.$a_username.
116 ', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
117 ', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
118 );
119 }
120
126 public function failedLoginObserver()
127 {
128 global $ilLog;
129 $ilLog->write(__METHOD__.': login failed'.
130 ', remote:'.$_SERVER['REMOTE_ADDR'].':'.$_SERVER['REMOTE_PORT'].
131 ', server:'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT']
132 );
133 }
134}
135
136// END WebDAV: Strip Microsoft Domain Names from logins
137?>
Auth_Container_MDB2($dsn)
Constructor of the container class.
Definition: MDB2.php:86
Storage driver for fetching login data from a database.
getUser($username)
Returns a user assoc array.
failedLoginObserver()
Called from Auth after failed login.
loginObserver($a_username)
Called from Auth after successful login.
setObserversEnabled($boolean)
Enables/disables the observers of this container.
static toUsernameWithoutDomain($username)
Static function removes Microsoft domain name from username.
fetchData($username, $password, $isChallengeResponse=false)
Get user information from database.
isObserversEnabled()
Returns true, if the observers of this container are enabled.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']