diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Chat/SystemMessage/Listener.php | 7 | ||||
-rw-r--r-- | lib/Collaboration/Collaborators/RoomPlugin.php | 4 | ||||
-rw-r--r-- | lib/Controller/FilesIntegrationController.php | 117 | ||||
-rw-r--r-- | lib/Controller/PublicShareAuthController.php | 4 | ||||
-rw-r--r-- | lib/Controller/PublicShareController.php | 148 | ||||
-rw-r--r-- | lib/Files/Listener.php | 2 | ||||
-rw-r--r-- | lib/Files/Util.php | 40 | ||||
-rw-r--r-- | lib/Notification/Notifier.php | 3 | ||||
-rw-r--r-- | lib/Share/RoomShareProvider.php | 27 |
9 files changed, 150 insertions, 202 deletions
diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php index 3933b6d3a..ed3826cc5 100644 --- a/lib/Chat/SystemMessage/Listener.php +++ b/lib/Chat/SystemMessage/Listener.php @@ -24,20 +24,15 @@ namespace OCA\Talk\Chat\SystemMessage; use OCA\Talk\Chat\ChatManager; -use OCA\Talk\Chat\MessageParser; -use OCA\Talk\Chat\Parser\SystemMessage; use OCA\Talk\Manager; -use OCA\Talk\Model\Message; use OCA\Talk\Participant; use OCA\Talk\Room; use OCA\Talk\Share\RoomShareProvider; use OCA\Talk\TalkSession; use OCA\Talk\Webinary; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\Comments\IComment; use OCP\IUser; use OCP\IUserSession; -use OCP\Share; use OCP\Share\IShare; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; @@ -250,7 +245,7 @@ class Listener { /** @var IShare $share */ $share = $event->getSubject(); - if ($share->getShareType() !== Share::SHARE_TYPE_ROOM) { + if ($share->getShareType() !== IShare::TYPE_ROOM) { return; } diff --git a/lib/Collaboration/Collaborators/RoomPlugin.php b/lib/Collaboration/Collaborators/RoomPlugin.php index 716477fe8..3a55f7dfd 100644 --- a/lib/Collaboration/Collaborators/RoomPlugin.php +++ b/lib/Collaboration/Collaborators/RoomPlugin.php @@ -29,7 +29,7 @@ use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\IUserSession; -use OCP\Share; +use OCP\Share\IShare; class RoomPlugin implements ISearchPlugin { @@ -86,7 +86,7 @@ class RoomPlugin implements ISearchPlugin { [ 'label' => $room->getDisplayName($userId), 'value' => [ - 'shareType' => Share::SHARE_TYPE_ROOM, + 'shareType' => IShare::TYPE_ROOM, 'shareWith' => $room->getToken() ] ]; diff --git a/lib/Controller/FilesIntegrationController.php b/lib/Controller/FilesIntegrationController.php index cd5d60b73..491709ef2 100644 --- a/lib/Controller/FilesIntegrationController.php +++ b/lib/Controller/FilesIntegrationController.php @@ -26,21 +26,35 @@ namespace OCA\Talk\Controller; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Files\Util; use OCA\Talk\Manager; +use OCA\Talk\TalkSession; +use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCSController; use OCP\Files\FileInfo; use OCP\Files\NotFoundException; use OCP\IL10N; use OCP\IRequest; +use OCP\ISession; +use OCP\IUser; +use OCP\IUserSession; +use OCP\Share\Exceptions\ShareNotFound; +use OCP\Share\IManager as IShareManager; use OCP\Share\IShare; class FilesIntegrationController extends OCSController { - /** @var string */ - private $currentUser; /** @var Manager */ private $manager; + /** @var IShareManager */ + private $shareManager; + /** @var ISession */ + private $session; + /** @var IUserSession */ + private $userSession; + /** @var TalkSession */ + private $talkSession; /** @var Util */ private $util; /** @var IL10N */ @@ -49,14 +63,20 @@ class FilesIntegrationController extends OCSController { public function __construct( string $appName, IRequest $request, - string $userId, Manager $manager, + IShareManager $shareManager, + ISession $session, + IUserSession $userSession, + TalkSession $talkSession, Util $util, IL10N $l10n ) { parent::__construct($appName, $request); - $this->currentUser = $userId; $this->manager = $manager; + $this->shareManager = $shareManager; + $this->session = $session; + $this->userSession = $userSession; + $this->talkSession = $talkSession; $this->util = $util; $this->l = $l10n; } @@ -66,7 +86,7 @@ class FilesIntegrationController extends OCSController { * * Returns the token of the room associated to the given file id. * - * This is the counterpart of PublicShareController::getRoom() for file ids + * This is the counterpart of self::getRoomByShareToken() for file ids * instead of share tokens, although both return the same room token if the * given file id and share token refer to the same file. * @@ -91,11 +111,17 @@ class FilesIntegrationController extends OCSController { * or "404 Not found" if the given file id was invalid. * @throws OCSNotFoundException */ - public function getRoom(string $fileId): DataResponse { - $share = $this->util->getAnyPublicShareOfFileOwnedByUserOrAnyDirectShareOfFileAccessibleByUser($fileId, $this->currentUser); + public function getRoomByFileId(string $fileId): DataResponse { + $currentUser = $this->userSession->getUser(); + if (!$currentUser instanceof IUser) { + throw new OCSException($this->l->t('File is not shared, or shared but not with the user'), Http::STATUS_UNAUTHORIZED); + } + + + $share = $this->util->getAnyPublicShareOfFileOwnedByUserOrAnyDirectShareOfFileAccessibleByUser($fileId, $currentUser->getUID()); $groupFolder = null; if (!$share) { - $groupFolder = $this->util->getGroupFolderNode($fileId, $this->currentUser); + $groupFolder = $this->util->getGroupFolderNode($fileId, $currentUser->getUID()); if (!$groupFolder) { throw new OCSNotFoundException($this->l->t('File is not shared, or shared but not with the user')); } @@ -122,6 +148,81 @@ class FilesIntegrationController extends OCSController { } /** + * @PublicPage + * @UseSession + * + * Returns the token of the room associated to the file id of the given + * share token. + * + * This is the counterpart of self::getRoomByFileId() for share tokens + * instead of file ids, although both return the same room token if the + * given file id and share token refer to the same file. + * + * If there is no room associated to the file id of the given share token a + * new room is created; the new room is a public room associated with a + * "file" object with the file id of the given share token. Unlike normal + * rooms in which the owner is the user that created the room these are + * special rooms without owner (although self joined users with direct + * access to the file become persistent participants automatically when they + * join until they explicitly leave or no longer have access to the file). + * + * In any case, to create or even get the token of the room, the file must + * be publicly shared (like a link share, for example); an error is returned + * otherwise. + * + * Besides the token of the room this also returns the current user ID and + * display name, if any; this is needed by the Talk sidebar to know the + * actual current user, as the public share page uses the incognito mode and + * thus logged in users as seen as guests. + * + * @param string $shareToken + * @return DataResponse the status code is "200 OK" if a room is returned, + * or "404 Not found" if the given share token was invalid. + */ + public function getRoomByShareToken(string $shareToken): DataResponse { + try { + $share = $this->shareManager->getShareByToken($shareToken); + if ($share->getPassword() !== null) { + $shareId = $this->session->get('public_link_authenticated'); + if ($share->getId() !== $shareId) { + throw new ShareNotFound(); + } + } + } catch (ShareNotFound $e) { + return new DataResponse([], Http::STATUS_NOT_FOUND); + } + + try { + if ($share->getNodeType() !== FileInfo::TYPE_FILE) { + return new DataResponse([], Http::STATUS_NOT_FOUND); + } + + $fileId = (string)$share->getNodeId(); + + try { + $room = $this->manager->getRoomByObject('file', $fileId); + } catch (RoomNotFoundException $e) { + $name = $share->getNode()->getName(); + $room = $this->manager->createPublicRoom($name, 'file', $fileId); + } + } catch (NotFoundException $e) { + return new DataResponse([], Http::STATUS_NOT_FOUND); + } + + $this->talkSession->setFileShareTokenForRoom($room->getToken(), $shareToken); + + $currentUser = $this->userSession->getUser(); + $currentUserId = $currentUser instanceof IUser ? $currentUser->getUID() : ''; + $currentUserDisplayName = $currentUser instanceof IUser ? $currentUser->getDisplayName() : ''; + + return new DataResponse([ + 'token' => $room->getToken(), + 'userId' => $currentUserId, + 'userDisplayName' => $currentUserDisplayName, + ]); + } + + /** * Returns the name of the file in the share. * * If the given share itself is a file its name is returned; otherwise the diff --git a/lib/Controller/PublicShareAuthController.php b/lib/Controller/PublicShareAuthController.php index 62edaf010..9221c860a 100644 --- a/lib/Controller/PublicShareAuthController.php +++ b/lib/Controller/PublicShareAuthController.php @@ -32,9 +32,9 @@ use OCP\IRequest; use OCP\IUser; use OCP\IUserManager; use OCP\IUserSession; -use OCP\Share; use OCP\Share\IManager as IShareManager; use OCP\Share\Exceptions\ShareNotFound; +use OCP\Share\IShare; class PublicShareAuthController extends OCSController { @@ -98,7 +98,7 @@ class PublicShareAuthController extends OCSController { return new DataResponse([], Http::STATUS_NOT_FOUND); } - if ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { + if ($share->getShareType() === IShare::TYPE_EMAIL) { $roomName = $share->getSharedWith(); } else { $roomName = trim($share->getTarget(), '/'); diff --git a/lib/Controller/PublicShareController.php b/lib/Controller/PublicShareController.php deleted file mode 100644 index a555ae86d..000000000 --- a/lib/Controller/PublicShareController.php +++ /dev/null @@ -1,148 +0,0 @@ -<?php -declare(strict_types=1); - -/** - * - * @copyright Copyright (c) 2019, Daniel Calviño Sánchez (danxuliu@gmail.com) - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCA\Talk\Controller; - -use OCA\Talk\Exceptions\RoomNotFoundException; -use OCA\Talk\Manager; -use OCA\Talk\TalkSession; -use OCP\AppFramework\Http; -use OCP\AppFramework\Http\DataResponse; -use OCP\AppFramework\OCSController; -use OCP\Files\FileInfo; -use OCP\Files\NotFoundException; -use OCP\IRequest; -use OCP\IUser; -use OCP\IUserManager; -use OCP\ISession; -use OCP\Share\Exceptions\ShareNotFound; -use OCP\Share\IManager as ShareManager; -use OCP\Share\IShare; - -class PublicShareController extends OCSController { - - /** @var string|null */ - private $userId; - /** @var IUserManager */ - private $userManager; - /** @var ShareManager */ - private $shareManager; - /** @var ISession */ - private $session; - /** @var TalkSession */ - private $talkSession; - /** @var Manager */ - private $manager; - - public function __construct( - $appName, - ?string $UserId, - IRequest $request, - IUserManager $userManager, - ShareManager $shareManager, - ISession $session, - TalkSession $talkSession, - Manager $manager - ) { - parent::__construct($appName, $request); - $this->userId = $UserId; - $this->userManager = $userManager; - $this->shareManager = $shareManager; - $this->session = $session; - $this->talkSession = $talkSession; - $this->manager = $manager; - } - - /** - * @PublicPage - * @UseSession - * - * Returns the token of the room associated to the file id of the given - * share token. - * - * This is the counterpart of FilesController::getRoom() for share tokens - * instead of file ids, although both return the same room token if the - * given file id and share token refer to the same file. - * - * If there is no room associated to the file id of the given share token a - * new room is created; the new room is a public room associated with a - * "file" object with the file id of the given share token. Unlike normal - * rooms in which the owner is the user that created the room these are - * special rooms without owner (although self joined users with direct - * access to the file become persistent participants automatically when they - * join until they explicitly leave or no longer have access to the file). - * - * In any case, to create or even get the token of the room, the file must - * be publicly shared (like a link share, for example); an error is returned - * otherwise. - * - * Besides the token of the room this also returns the current user ID and - * display name, if any; this is needed by the Talk sidebar to know the - * actual current user, as the public share page uses the incognito mode and - * thus logged in users as seen as guests. - * - * @param string $shareToken - * @return DataResponse the status code is "200 OK" if a room is returned, - * or "404 Not found" if the given share token was invalid. - */ - public function getRoom(string $shareToken) { - try { - $share = $this->shareManager->getShareByToken($shareToken); - if ($share->getPassword() !== null) { - $shareId = $this->session->get('public_link_authenticated'); - if ($share->getId() !== $shareId) { - throw new ShareNotFound(); - } - } - } catch (ShareNotFound $e) { - return new DataResponse([], Http::STATUS_NOT_FOUND); - } - - if ($share->getNodeType() !== FileInfo::TYPE_FILE) { - return new DataResponse([], Http::STATUS_NOT_FOUND); - } - - $fileId = (string)$share->getNodeId(); - - try { - $room = $this->manager->getRoomByObject('file', $fileId); - } catch (RoomNotFoundException $e) { - $name = $share->getNode()->getName(); - $room = $this->manager->createPublicRoom($name, 'file', $fileId); - } - - $this->talkSession->setFileShareTokenForRoom($room->getToken(), $shareToken); - - $currentUser = $this->userManager->get($this->userId); - $currentUserId = $currentUser instanceof IUser ? $currentUser->getUID() : ''; - $currentUserDisplayName = $currentUser instanceof IUser ? $currentUser->getDisplayName() : ''; - - return new DataResponse([ - 'token' => $room->getToken(), - 'userId' => $currentUserId, - 'userDisplayName' => $currentUserDisplayName, - ]); - } - -} diff --git a/lib/Files/Listener.php b/lib/Files/Listener.php index 0cac3a6fa..a71e080cc 100644 --- a/lib/Files/Listener.php +++ b/lib/Files/Listener.php @@ -138,7 +138,7 @@ class Listener { * @param Room $room * @param string $userId */ - public function addUserAsPersistentParticipant(Room $room, string $userId) { + public function addUserAsPersistentParticipant(Room $room, string $userId): void { if ($room->getObjectType() !== 'file') { return; } diff --git a/lib/Files/Util.php b/lib/Files/Util.php index c4dc0af10..3789ca37e 100644 --- a/lib/Files/Util.php +++ b/lib/Files/Util.php @@ -156,13 +156,13 @@ class Util { $reshares = false; $limit = 1; - $shares = $this->shareManager->getSharesBy($userId, \OCP\Share::SHARE_TYPE_LINK, $node, $reshares, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharesBy($userId, IShare::TYPE_LINK, $node, $reshares, $limit); + if (!empty($shares)) { return $shares[0]; } - $shares = $this->shareManager->getSharesBy($userId, \OCP\Share::SHARE_TYPE_EMAIL, $node, $reshares, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharesBy($userId, IShare::TYPE_EMAIL, $node, $reshares, $limit); + if (!empty($shares)) { return $shares[0]; } @@ -180,23 +180,23 @@ class Util { $reshares = false; $limit = 1; - $shares = $this->shareManager->getSharesBy($userId, \OCP\Share::SHARE_TYPE_USER, $node, $reshares, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharesBy($userId, IShare::TYPE_USER, $node, $reshares, $limit); + if (!empty($shares)) { return $shares[0]; } - $shares = $this->shareManager->getSharesBy($userId, \OCP\Share::SHARE_TYPE_GROUP, $node, $reshares, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharesBy($userId, IShare::TYPE_GROUP, $node, $reshares, $limit); + if (!empty($shares)) { return $shares[0]; } - $shares = $this->shareManager->getSharesBy($userId, \OCP\Share::SHARE_TYPE_CIRCLE, $node, $reshares, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharesBy($userId, IShare::TYPE_CIRCLE, $node, $reshares, $limit); + if (!empty($shares)) { return $shares[0]; } - $shares = $this->shareManager->getSharesBy($userId, \OCP\Share::SHARE_TYPE_ROOM, $node, $reshares, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharesBy($userId, IShare::TYPE_ROOM, $node, $reshares, $limit); + if (!empty($shares)) { return $shares[0]; } @@ -207,23 +207,23 @@ class Util { return null; } - $shares = $this->shareManager->getSharedWith($userId, \OCP\Share::SHARE_TYPE_USER, $node, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharedWith($userId, IShare::TYPE_USER, $node, $limit); + if (!empty($shares)) { return $shares[0]; } - $shares = $this->shareManager->getSharedWith($userId, \OCP\Share::SHARE_TYPE_GROUP, $node, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharedWith($userId, IShare::TYPE_GROUP, $node, $limit); + if (!empty($shares)) { return $shares[0]; } - $shares = $this->shareManager->getSharedWith($userId, \OCP\Share::SHARE_TYPE_CIRCLE, $node, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharedWith($userId, IShare::TYPE_CIRCLE, $node, $limit); + if (!empty($shares)) { return $shares[0]; } - $shares = $this->shareManager->getSharedWith($userId, \OCP\Share::SHARE_TYPE_ROOM, $node, $limit); - if (\count($shares) > 0) { + $shares = $this->shareManager->getSharedWith($userId, IShare::TYPE_ROOM, $node, $limit); + if (!empty($shares)) { return $shares[0]; } diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 1083e05e4..f34037610 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -47,6 +47,7 @@ use OCP\RichObjectStrings\Definitions; use OCP\Share; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager as IShareManager; +use OCP\Share\IShare; class Notifier implements INotifier { @@ -544,7 +545,7 @@ class Notifier implements INotifier { $notification = $this->addActionButton($notification, $l->t('Call back')); } - if ($share->getShareType() === Share::SHARE_TYPE_EMAIL) { + if ($share->getShareType() === IShare::TYPE_EMAIL) { $sharedWith = $share->getSharedWith(); if ($callIsActive) { $subject = $l->t('{email} is requesting the password to access {file}'); diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 70506059b..86aa89d7d 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -42,7 +42,6 @@ use OCP\Share\Exceptions\GenericShareException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager as IShareManager; use OCP\Share\IShare; -use OCP\Share\IShareHelper; use OCP\Share\IShareProvider; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; @@ -223,7 +222,7 @@ class RoomShareProvider implements IShareProvider { ): int { $qb = $this->dbConnection->getQueryBuilder(); $qb->insert('share') - ->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM)) + ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)) ->setValue('share_with', $qb->createNamedParameter($shareWith)) ->setValue('uid_initiator', $qb->createNamedParameter($sharedBy)) ->setValue('uid_owner', $qb->createNamedParameter($shareOwner)) @@ -530,7 +529,7 @@ class RoomShareProvider implements IShareProvider { $qb->expr()->eq('item_type', $qb->createNamedParameter('folder')) )) ->andWhere( - $qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM)) + $qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)) ); /** @@ -578,7 +577,7 @@ class RoomShareProvider implements IShareProvider { $qb->select('*') ->from('share'); - $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))); + $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))); /** * Reshares for this user are shares where they are the owner. @@ -635,7 +634,7 @@ class RoomShareProvider implements IShareProvider { ->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')) ->leftJoin('f', 'storages', 'st', $qb->expr()->eq('f.storage', 'st.numeric_id')) ->where($qb->expr()->eq('s.id', $qb->createNamedParameter($id))) - ->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))); + ->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))); $cursor = $qb->execute(); $data = $cursor->fetch(); @@ -731,7 +730,7 @@ class RoomShareProvider implements IShareProvider { $cursor = $qb->select('*') ->from('share') ->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($path->getId()))) - ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))) + ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->execute(); $shares = []; @@ -791,7 +790,7 @@ class RoomShareProvider implements IShareProvider { $rooms = array_map(function(Room $room) { return $room->getToken(); }, $rooms); - $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))) + $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter( $rooms, IQueryBuilder::PARAM_STR_ARRAY @@ -852,7 +851,7 @@ class RoomShareProvider implements IShareProvider { $cursor = $qb->select('*') ->from('share') - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))) + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token))) ->execute(); @@ -926,7 +925,7 @@ class RoomShareProvider implements IShareProvider { $qb = $this->dbConnection->getQueryBuilder(); - $types = [\OCP\Share::SHARE_TYPE_ROOM]; + $types = [IShare::TYPE_ROOM]; if ($currentAccess) { $types[] = self::SHARE_TYPE_USERROOM; } @@ -944,7 +943,7 @@ class RoomShareProvider implements IShareProvider { $users = []; while($row = $cursor->fetch()) { $type = (int)$row['share_type']; - if ($type === \OCP\Share::SHARE_TYPE_ROOM) { + if ($type === IShare::TYPE_ROOM) { $roomToken = $row['share_with']; try { $room = $this->manager->getRoomByToken($roomToken); @@ -1026,7 +1025,7 @@ class RoomShareProvider implements IShareProvider { $qb->select('*') ->from('share') ->where($qb->expr()->eq('parent', $qb->createNamedParameter($parent->getId()))) - ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))) + ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->orderBy('id'); $cursor = $qb->execute(); @@ -1055,7 +1054,7 @@ class RoomShareProvider implements IShareProvider { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('id') ->from('share') - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))) + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($roomToken))); if ($user !== null) { @@ -1082,7 +1081,7 @@ class RoomShareProvider implements IShareProvider { // Now delete all the original room shares $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share') - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))) + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($roomToken))); if ($user !== null) { @@ -1096,7 +1095,7 @@ class RoomShareProvider implements IShareProvider { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('id') ->from('share') - ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_ROOM))) + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_ROOM))) ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($roomToken))); $cursor = $qb->execute(); |