Merge pull request #17110 from owncloud/share-error-handling
[sharing] handle shares of users that aren't available anymore
This commit is contained in:
commit
5f59393b30
|
@ -9,6 +9,7 @@
|
||||||
namespace OCA\Files_Sharing;
|
namespace OCA\Files_Sharing;
|
||||||
|
|
||||||
use OC\Files\Filesystem;
|
use OC\Files\Filesystem;
|
||||||
|
use OC\User\NoUserException;
|
||||||
use OCA\Files_Sharing\Propagation\PropagationManager;
|
use OCA\Files_Sharing\Propagation\PropagationManager;
|
||||||
use OCP\Files\Config\IMountProvider;
|
use OCP\Files\Config\IMountProvider;
|
||||||
use OCP\Files\Storage\IStorageFactory;
|
use OCP\Files\Storage\IStorageFactory;
|
||||||
|
@ -50,8 +51,13 @@ class MountProvider implements IMountProvider {
|
||||||
$shares = array_filter($shares, function ($share) {
|
$shares = array_filter($shares, function ($share) {
|
||||||
return $share['permissions'] > 0;
|
return $share['permissions'] > 0;
|
||||||
});
|
});
|
||||||
return array_map(function ($share) use ($user, $storageFactory) {
|
$shares = array_map(function ($share) use ($user, $storageFactory) {
|
||||||
Filesystem::initMountPoints($share['uid_owner']);
|
try {
|
||||||
|
Filesystem::initMountPoints($share['uid_owner']);
|
||||||
|
} catch(NoUserException $e) {
|
||||||
|
\OC::$server->getLogger()->warning('The user \'' . $share['uid_owner'] . '\' of share with ID \'' . $share['id'] . '\' can\'t be retrieved.', array('app' => 'files_sharing'));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// for updating etags for the share owner when we make changes to this share.
|
// for updating etags for the share owner when we make changes to this share.
|
||||||
$ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']);
|
$ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']);
|
||||||
|
|
||||||
|
@ -68,5 +74,7 @@ class MountProvider implements IMountProvider {
|
||||||
$storageFactory
|
$storageFactory
|
||||||
);
|
);
|
||||||
}, $shares);
|
}, $shares);
|
||||||
|
// array_filter removes the null values from the array
|
||||||
|
return array_filter($shares);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,6 +365,7 @@ class Filesystem {
|
||||||
* Initialize system and personal mount points for a user
|
* Initialize system and personal mount points for a user
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
|
* @throws \OC\User\NoUserException if the user is not available
|
||||||
*/
|
*/
|
||||||
public static function initMountPoints($user = '') {
|
public static function initMountPoints($user = '') {
|
||||||
if ($user == '') {
|
if ($user == '') {
|
||||||
|
|
Loading…
Reference in New Issue