ZP-765 AuthUser is now an instance class variable. Released under the Affero...

ZP-765 AuthUser is now an instance class variable. Released under the Affero GNU General Public License (AGPL) version 3.
parent 88c3af2a
...@@ -171,6 +171,7 @@ class ZLog { ...@@ -171,6 +171,7 @@ class ZLog {
self::$logger = new $logger(); self::$logger = new $logger();
self::$logger->SetUser($user); self::$logger->SetUser($user);
self::$logger->SetAuthUser(Request::GetAuthUser());
self::$logger->SetSpecialLogUsers($specialLogUsers); self::$logger->SetSpecialLogUsers($specialLogUsers);
self::$logger->SetDevid('['. Request::GetDeviceID() .']'); self::$logger->SetDevid('['. Request::GetDeviceID() .']');
self::$logger->SetPidstr('[' . str_pad(@getmypid(),5," ",STR_PAD_LEFT) . ']'); self::$logger->SetPidstr('[' . str_pad(@getmypid(),5," ",STR_PAD_LEFT) . ']');
......
...@@ -55,7 +55,7 @@ class FileLog extends Log { ...@@ -55,7 +55,7 @@ class FileLog extends Log {
*/ */
private function getLogToUserFile() { private function getLogToUserFile() {
if ($this->log_to_user_file === false) { if ($this->log_to_user_file === false) {
$this->setLogToUserFile(preg_replace('/[^a-z0-9]/', '_', strtolower(Request::GetAuthUser())) . '.log'); $this->setLogToUserFile(preg_replace('/[^a-z0-9]/', '_', strtolower($this->GetAuthUser())) . '.log');
} }
return $this->log_to_user_file; return $this->log_to_user_file;
} }
......
...@@ -46,6 +46,12 @@ abstract class Log { ...@@ -46,6 +46,12 @@ abstract class Log {
* @var string * @var string
*/ */
protected $user = ''; protected $user = '';
/**
* @var string
*/
protected $authUser = '';
/** /**
* @var string * @var string
*/ */
...@@ -83,6 +89,23 @@ abstract class Log { ...@@ -83,6 +89,23 @@ abstract class Log {
$this->user = $value; $this->user = $value;
} }
/**
* @access public
* @return string
*/
public function GetAuthUser() {
return $this->authUser;
}
/**
* @param string $value
*
* @access public
*/
public function SetAuthUser($value) {
$this->authUser = $value;
}
/** /**
* @access public * @access public
* @return string * @return string
...@@ -167,7 +190,7 @@ abstract class Log { ...@@ -167,7 +190,7 @@ abstract class Log {
$this->Write($loglevel, $message); $this->Write($loglevel, $message);
} }
if ($loglevel <= LOGUSERLEVEL && $this->HasSpecialLogUsers()) { if ($loglevel <= LOGUSERLEVEL && $this->HasSpecialLogUsers()) {
if (RequestProcessor::isUserAuthenticated() && $this->IsUserInSpecialLogUsers(Request::GetAuthUser())) { if (RequestProcessor::isUserAuthenticated() && $this->IsUserInSpecialLogUsers($this->GetAuthUser())) {
// something was logged before the user was authenticated, write this to the log // something was logged before the user was authenticated, write this to the log
if (!empty($this->unauthMessageCache)) { if (!empty($this->unauthMessageCache)) {
foreach ($this->unauthMessageCache as $authcache) { foreach ($this->unauthMessageCache as $authcache) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment