diff options
Diffstat (limited to 'lib/private/user/user.php')
-rw-r--r-- | lib/private/user/user.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/private/user/user.php b/lib/private/user/user.php index bc5c541e521..8aba7188e24 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -43,6 +43,11 @@ class User { private $home; /** + * @var int $lastLogin + */ + private $lastLogin; + + /** * @var \OC\AllConfig $config */ private $config; @@ -64,6 +69,7 @@ class User { } else { $this->enabled = true; } + $this->lastLogin = \OC_Preferences::getValue($uid, 'login', 'lastLogin', 0); } /** @@ -108,6 +114,25 @@ class User { } /** + * returns the timestamp of the user's last login or 0 if the user did never + * login + * + * @return int + */ + public function getLastLogin() { + return $this->lastLogin; + } + + /** + * updates the timestamp of the most recent login of this user + */ + public function updateLastLoginTimestamp() { + $this->lastLogin = time(); + \OC_Preferences::setValue( + $this->uid, 'login', 'lastLogin', $this->lastLogin); + } + + /** * Delete the user * * @return bool |