aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/User/OfflineUser.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/User/OfflineUser.php')
-rw-r--r--apps/user_ldap/lib/User/OfflineUser.php74
1 files changed, 23 insertions, 51 deletions
diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php
index 309eeec52c7..ecaab7188ba 100644
--- a/apps/user_ldap/lib/User/OfflineUser.php
+++ b/apps/user_ldap/lib/User/OfflineUser.php
@@ -1,28 +1,10 @@
<?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>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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: 2017-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCA\User_LDAP\User;
use OCA\User_LDAP\Mapping\UserMapping;
@@ -33,10 +15,6 @@ use OCP\Share\IShare;
class OfflineUser {
/**
- * @var string $ocName
- */
- protected $ocName;
- /**
* @var string $dn
*/
protected $dn;
@@ -60,6 +38,7 @@ class OfflineUser {
* @var string $foundDeleted the timestamp when the user was detected as unavailable
*/
protected $foundDeleted;
+ protected ?string $extStorageHome = null;
/**
* @var string $email
*/
@@ -69,30 +48,19 @@ class OfflineUser {
*/
protected $hasActiveShares;
/**
- * @var IConfig $config
- */
- protected $config;
- /**
* @var IDBConnection $db
*/
protected $db;
+
/**
- * @var \OCA\User_LDAP\Mapping\UserMapping
+ * @param string $ocName
*/
- protected $mapping;
- /** @var IManager */
- private $shareManager;
-
public function __construct(
- $ocName,
- IConfig $config,
- UserMapping $mapping,
- IManager $shareManager
+ protected $ocName,
+ protected IConfig $config,
+ protected UserMapping $mapping,
+ private IManager $shareManager,
) {
- $this->ocName = $ocName;
- $this->config = $config;
- $this->mapping = $mapping;
- $this->shareManager = $shareManager;
}
/**
@@ -146,7 +114,8 @@ class OfflineUser {
*/
public function getDN() {
if ($this->dn === null) {
- $this->fetchDetails();
+ $dn = $this->mapping->getDNByName($this->ocName);
+ $this->dn = ($dn !== false) ? $dn : '';
}
return $this->dn;
}
@@ -206,13 +175,20 @@ class OfflineUser {
return (int)$this->foundDeleted;
}
+ public function getExtStorageHome(): string {
+ if ($this->extStorageHome === null) {
+ $this->fetchDetails();
+ }
+ return (string)$this->extStorageHome;
+ }
+
/**
* getter for having active shares
* @return bool
*/
public function getHasActiveShares() {
if ($this->hasActiveShares === null) {
- $this->fetchDetails();
+ $this->determineShares();
}
return $this->hasActiveShares;
}
@@ -226,17 +202,13 @@ class OfflineUser {
'uid' => 'user_ldap',
'homePath' => 'user_ldap',
'foundDeleted' => 'user_ldap',
+ 'extStorageHome' => 'user_ldap',
'email' => 'settings',
'lastLogin' => 'login',
];
foreach ($properties as $property => $app) {
$this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
}
-
- $dn = $this->mapping->getDNByName($this->ocName);
- $this->dn = ($dn !== false) ? $dn : '';
-
- $this->determineShares();
}
/**
@@ -248,7 +220,7 @@ class OfflineUser {
$shareConstants = $shareInterface->getConstants();
foreach ($shareConstants as $constantName => $constantValue) {
- if (strpos($constantName, 'TYPE_') !== 0
+ if (!str_starts_with($constantName, 'TYPE_')
|| $constantValue === IShare::TYPE_USERGROUP
) {
continue;