aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/User
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-12-17 17:37:45 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-12-21 17:24:28 +0100
commit85f14bc591e764d36c570cec0b594a4f818d675a (patch)
treecc58ed631757433e8d85c92d178d49ad01658859 /apps/user_ldap/lib/User
parentfbd4e9e6513426b0809fcc6fc1faec72e6b52d2d (diff)
downloadnextcloud-server-85f14bc591e764d36c570cec0b594a4f818d675a.tar.gz
nextcloud-server-85f14bc591e764d36c570cec0b594a4f818d675a.zip
LDAP: extend remnants output with "detected on" field
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/User')
-rw-r--r--apps/user_ldap/lib/User/DeletedUsersIndex.php6
-rw-r--r--apps/user_ldap/lib/User/OfflineUser.php30
2 files changed, 28 insertions, 8 deletions
diff --git a/apps/user_ldap/lib/User/DeletedUsersIndex.php b/apps/user_ldap/lib/User/DeletedUsersIndex.php
index 3473398f415..0f0d4859c23 100644
--- a/apps/user_ldap/lib/User/DeletedUsersIndex.php
+++ b/apps/user_ldap/lib/User/DeletedUsersIndex.php
@@ -108,7 +108,13 @@ class DeletedUsersIndex {
* @throws \OCP\PreConditionNotMetException
*/
public function markUser($ocName) {
+ $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0');
+ if($curValue === '1') {
+ // the user is already marked, do not write to DB again
+ return;
+ }
$this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1');
+ $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time());
$this->deletedUsers = null;
}
}
diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php
index 9576b49d5a2..5ed158cc105 100644
--- a/apps/user_ldap/lib/User/OfflineUser.php
+++ b/apps/user_ldap/lib/User/OfflineUser.php
@@ -54,6 +54,10 @@ class OfflineUser {
*/
protected $lastLogin;
/**
+ * @var string $foundDeleted the timestamp when the user was detected as unavailable
+ */
+ protected $foundDeleted;
+ /**
* @var string $email
*/
protected $email;
@@ -92,7 +96,8 @@ class OfflineUser {
* remove the Delete-flag from the user.
*/
public function unmark() {
- $this->config->setUserValue($this->ocName, 'user_ldap', 'isDeleted', '0');
+ $this->config->deleteUserValue($this->ocName, 'user_ldap', 'isDeleted');
+ $this->config->deleteUserValue($this->ocName, 'user_ldap', 'foundDeleted');
}
/**
@@ -170,6 +175,14 @@ class OfflineUser {
}
/**
+ * getter for the detection timestamp
+ * @return int
+ */
+ public function getDetectedOn() {
+ return (int)$this->foundDeleted;
+ }
+
+ /**
* getter for having active shares
* @return bool
*/
@@ -181,13 +194,14 @@ class OfflineUser {
* reads the user details
*/
protected function fetchDetails() {
- $properties = array (
- 'displayName' => 'user_ldap',
- 'uid' => 'user_ldap',
- 'homePath' => 'user_ldap',
- 'email' => 'settings',
- 'lastLogin' => 'login'
- );
+ $properties = [
+ 'displayName' => 'user_ldap',
+ 'uid' => 'user_ldap',
+ 'homePath' => 'user_ldap',
+ 'foundDeleted' => 'user_ldap',
+ 'email' => 'settings',
+ 'lastLogin' => 'login',
+ ];
foreach($properties as $property => $app) {
$this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
}