diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-01-22 14:17:37 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-01-22 14:17:37 +0100 |
commit | bd456b5889443816d80278e0818ae64bd32ffe4d (patch) | |
tree | 17f023add661f5c9a0e867915bda7b31a89f61da | |
parent | 9b4c9a0357ba9a10f4e0c7c1cafb3923ba5929db (diff) | |
download | nextcloud-server-bd456b5889443816d80278e0818ae64bd32ffe4d.tar.gz nextcloud-server-bd456b5889443816d80278e0818ae64bd32ffe4d.zip |
Fix addUserToGroup hook of the share code
* sets up the filesystem of the user that is added to a group
to properly accept shares
* fixes #18499
-rw-r--r-- | lib/private/share/hooks.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/share/hooks.php b/lib/private/share/hooks.php index 1fa233916d1..0caa1a3aa8a 100644 --- a/lib/private/share/hooks.php +++ b/lib/private/share/hooks.php @@ -55,6 +55,15 @@ class Hooks extends \OC\Share\Constants { * @param array $arguments */ public static function pre_addToGroup($arguments) { + $currentUser = \OC::$server->getUserSession()->getUser(); + $currentUserID = is_null($currentUser) ? '' : $currentUser->getUID(); + + // setup filesystem for added user if it isn't the current user + if($currentUserID !== $arguments['uid']) { + \OC_Util::tearDownFS(); + \OC_Util::setupFS($arguments['uid']); + } + /** @var \OC\DB\Connection $db */ $db = \OC::$server->getDatabaseConnection(); @@ -120,6 +129,14 @@ class Hooks extends \OC\Share\Constants { ]; } } + + // re-setup old filesystem state + if($currentUserID !== $arguments['uid']) { + \OC_Util::tearDownFS(); + if($currentUserID !== '') { + \OC_Util::setupFS($currentUserID); + } + } } /** |