From 1d09083602ac2de5c1a176df52d9a1aac9a23ee2 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 15 Nov 2022 10:49:11 -0100 Subject: [PATCH] fix call to deprecated circles api Signed-off-by: Maxence Lange --- .../lib/Controller/ShareAPIController.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 43f43d10731a3..86f04c4a3eeac 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -46,10 +46,10 @@ use OC\Files\FileInfo; use OC\Files\Storage\Wrapper\Wrapper; +use OCA\Files\Helper; use OCA\Files_Sharing\Exceptions\SharingRightsException; use OCA\Files_Sharing\External\Storage; use OCA\Files_Sharing\SharedStorage; -use OCA\Files\Helper; use OCP\App\IAppManager; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; @@ -59,9 +59,9 @@ use OCP\AppFramework\OCSController; use OCP\AppFramework\QueryException; use OCP\Constants; +use OCP\Files\Folder; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; -use OCP\Files\Folder; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\IConfig; @@ -74,7 +74,6 @@ use OCP\IUserManager; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; -use OCP\Share; use OCP\Share\Exceptions\GenericShareException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; @@ -1797,12 +1796,16 @@ private function shareProviderResharingRights(string $userId, IShare $share, $no $sharedWith = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); } try { - $member = \OCA\Circles\Api\v1\Circles::getMember($sharedWith, $userId, 1); - if ($member->getLevel() >= 4) { - return true; - } + // checking if user is within said circle + // deprecated API, needs to be edited when ICirclesManager is implemented + \OCA\Circles\Api\v1\Circles::getMember($sharedWith, $userId, 1); + + return true; + } catch (\OCA\Circles\Exceptions\MembershipNotFoundException $e) { return false; - } catch (QueryException $e) { + } catch (\Exception $e) { + \OC::$server->getLogger()->logException($e); + return false; } }