Merge pull request #21854 from owncloud/fix-share-hook-group-add

Fix addUserToGroup hook of the share code
This commit is contained in:
Thomas Müller 2016-02-25 16:56:19 +01:00
commit 776d91f3bc
1 changed files with 17 additions and 0 deletions

View File

@ -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);
}
}
}
/**