split instantiation from business logic in OfflineUser

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2020-10-26 13:54:03 +01:00 committed by backportbot[bot]
parent 394ec564af
commit 7544f0c508
1 changed files with 24 additions and 1 deletions

View File

@ -90,7 +90,6 @@ class OfflineUser {
$this->config = $config; $this->config = $config;
$this->db = $db; $this->db = $db;
$this->mapping = $mapping; $this->mapping = $mapping;
$this->fetchDetails();
} }
/** /**
@ -132,6 +131,9 @@ class OfflineUser {
* @return string * @return string
*/ */
public function getUID() { public function getUID() {
if (!isset($this->uid)) {
$this->fetchDetails();
}
return $this->uid; return $this->uid;
} }
@ -140,6 +142,9 @@ class OfflineUser {
* @return string * @return string
*/ */
public function getDN() { public function getDN() {
if (!isset($this->dn)) {
$this->fetchDetails();
}
return $this->dn; return $this->dn;
} }
@ -148,6 +153,9 @@ class OfflineUser {
* @return string * @return string
*/ */
public function getDisplayName() { public function getDisplayName() {
if (!isset($this->displayName)) {
$this->fetchDetails();
}
return $this->displayName; return $this->displayName;
} }
@ -156,6 +164,9 @@ class OfflineUser {
* @return string * @return string
*/ */
public function getEmail() { public function getEmail() {
if (!isset($this->email)) {
$this->fetchDetails();
}
return $this->email; return $this->email;
} }
@ -164,6 +175,9 @@ class OfflineUser {
* @return string * @return string
*/ */
public function getHomePath() { public function getHomePath() {
if (!isset($this->homePath)) {
$this->fetchDetails();
}
return $this->homePath; return $this->homePath;
} }
@ -172,6 +186,9 @@ class OfflineUser {
* @return int * @return int
*/ */
public function getLastLogin() { public function getLastLogin() {
if (!isset($this->lastLogin)) {
$this->fetchDetails();
}
return (int)$this->lastLogin; return (int)$this->lastLogin;
} }
@ -180,6 +197,9 @@ class OfflineUser {
* @return int * @return int
*/ */
public function getDetectedOn() { public function getDetectedOn() {
if (!isset($this->foundDeleted)) {
$this->fetchDetails();
}
return (int)$this->foundDeleted; return (int)$this->foundDeleted;
} }
@ -188,6 +208,9 @@ class OfflineUser {
* @return bool * @return bool
*/ */
public function getHasActiveShares() { public function getHasActiveShares() {
if (!isset($this->hasActiveShares)) {
$this->fetchDetails();
}
return $this->hasActiveShares; return $this->hasActiveShares;
} }