aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/User/DeletedUsersIndex.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/User/DeletedUsersIndex.php')
-rw-r--r--apps/user_ldap/lib/User/DeletedUsersIndex.php45
1 files changed, 14 insertions, 31 deletions
diff --git a/apps/user_ldap/lib/User/DeletedUsersIndex.php b/apps/user_ldap/lib/User/DeletedUsersIndex.php
index d679ca86d93..f57f71a9d47 100644
--- a/apps/user_ldap/lib/User/DeletedUsersIndex.php
+++ b/apps/user_ldap/lib/User/DeletedUsersIndex.php
@@ -1,30 +1,14 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\User_LDAP\User;
use OCA\User_LDAP\Mapping\UserMapping;
use OCP\IConfig;
+use OCP\PreConditionNotMetException;
use OCP\Share\IManager;
/**
@@ -32,19 +16,13 @@ use OCP\Share\IManager;
* @package OCA\User_LDAP
*/
class DeletedUsersIndex {
- protected IConfig $config;
- protected UserMapping $mapping;
protected ?array $deletedUsers = null;
- private IManager $shareManager;
public function __construct(
- IConfig $config,
- UserMapping $mapping,
- IManager $shareManager
+ protected IConfig $config,
+ protected UserMapping $mapping,
+ private IManager $shareManager,
) {
- $this->config = $config;
- $this->mapping = $mapping;
- $this->shareManager = $shareManager;
}
/**
@@ -56,7 +34,12 @@ class DeletedUsersIndex {
$userObjects = [];
foreach ($deletedUsers as $user) {
- $userObjects[] = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager);
+ $userObject = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager);
+ if ($userObject->getLastLogin() > $userObject->getDetectedOn()) {
+ $userObject->unmark();
+ } else {
+ $userObjects[] = $userObject;
+ }
}
$this->deletedUsers = $userObjects;
@@ -87,7 +70,7 @@ class DeletedUsersIndex {
/**
* marks a user as deleted
*
- * @throws \OCP\PreConditionNotMetException
+ * @throws PreConditionNotMetException
*/
public function markUser(string $ocName): void {
if ($this->isUserMarked($ocName)) {