diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-10-28 15:11:41 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-01-08 09:21:21 +0100 |
commit | 411a47cadb078987f1354dfcae0852154df42a06 (patch) | |
tree | c35a78fe4f300eacab7834c092a891deccc6f46f /apps/user_ldap/lib | |
parent | 69ae7abe72fd032adbec1c7dc01fca64aea2fbe8 (diff) | |
download | nextcloud-server-411a47cadb078987f1354dfcae0852154df42a06.tar.gz nextcloud-server-411a47cadb078987f1354dfcae0852154df42a06.zip |
relax strict getHome behaviour for LDAP users in a shadow state
* simplifies deletion process
* less strange behaviour when looking up home storage (as long as it is local)
* thus could enable transfer ownerships after user went invisible on ldap
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/User_LDAP.php | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index b62a5f95a42..c3f25f098d7 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -47,7 +47,6 @@ use OCA\User_LDAP\User\OfflineUser; use OCA\User_LDAP\User\User; use OCP\IConfig; use OCP\ILogger; -use OCP\IUser; use OCP\IUserSession; use OCP\Notification\IManager as INotificationManager; use OCP\Util; @@ -59,9 +58,6 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn /** @var INotificationManager */ protected $notificationManager; - /** @var string */ - protected $currentUserInDeletionProcess; - /** @var UserPluginManager */ protected $userPluginManager; @@ -76,20 +72,6 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn $this->ocConfig = $ocConfig; $this->notificationManager = $notificationManager; $this->userPluginManager = $userPluginManager; - $this->registerHooks($userSession); - } - - protected function registerHooks(IUserSession $userSession) { - $userSession->listen('\OC\User', 'preDelete', [$this, 'preDeleteUser']); - $userSession->listen('\OC\User', 'postDelete', [$this, 'postDeleteUser']); - } - - public function preDeleteUser(IUser $user) { - $this->currentUserInDeletionProcess = $user->getUID(); - } - - public function postDeleteUser() { - $this->currentUserInDeletionProcess = null; } /** @@ -430,21 +412,13 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn // early return path if it is a deleted user $user = $this->access->userManager->get($uid); - if($user instanceof OfflineUser) { - if($this->currentUserInDeletionProcess !== null - && $this->currentUserInDeletionProcess === $user->getOCName() - ) { - return $user->getHomePath(); - } else { - throw new NoUserException($uid . ' is not a valid user anymore'); - } - } else if ($user === null) { + if($user instanceof User || $user instanceof OfflineUser) { + $path = $user->getHomePath() ?: false; + } else { throw new NoUserException($uid . ' is not a valid user anymore'); } - $path = $user->getHomePath(); $this->access->cacheUserHome($uid, $path); - return $path; } |