diff options
Diffstat (limited to 'lib/Share/RoomShareProvider.php')
-rw-r--r-- | lib/Share/RoomShareProvider.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 9e3c4ad90..24b1aa82d 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -34,6 +34,7 @@ use OCA\Talk\Events\RoomEvent; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; +use OCA\Talk\Model\Attendee; use OCA\Talk\Room; use OCA\Talk\Service\ParticipantService; use OCP\AppFramework\Utility\ITimeFactory; @@ -142,13 +143,18 @@ class RoomShareProvider implements IShareProvider { } try { - $room->getParticipant($share->getSharedBy(), false); + $participant = $room->getParticipant($share->getSharedBy(), false); } catch (ParticipantNotFoundException $e) { // If the sharer is not a participant of the room even if the room // exists the error is still "Room not found". throw new GenericShareException('Room not found', $this->l->t('Conversation not found'), 404); } + if (!($participant->getPermissions() & Attendee::PERMISSIONS_CHAT)) { + // No chat permissions is like read-only + throw new GenericShareException('Room not found', $this->l->t('Conversation not found'), 404); + } + $existingShares = $this->getSharesByPath($share->getNode()); foreach ($existingShares as $existingShare) { if ($existingShare->getSharedWith() === $share->getSharedWith()) { |