Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Sein <ivan@struktur.de>2018-11-20 13:48:03 +0300
committerGitHub <noreply@github.com>2018-11-20 13:48:03 +0300
commit17135c9f87cc6b2b81ca17e781ea1ba23db74679 (patch)
treed287bfe04ec4fbc7e06df7f75a014c5c41e8cabc /lib/PublicShareAuth
parentd00f88f52655e146c953477600d7c64d05fedd2a (diff)
parent56e90228ab327498569915759e7b3cf6cf688ea7 (diff)
Merge pull request #1286 from nextcloud/add-session-to-participant
Add session & participantFlags to participant
Diffstat (limited to 'lib/PublicShareAuth')
-rw-r--r--lib/PublicShareAuth/Listener.php21
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/PublicShareAuth/Listener.php b/lib/PublicShareAuth/Listener.php
index 11d70905d..b622e2162 100644
--- a/lib/PublicShareAuth/Listener.php
+++ b/lib/PublicShareAuth/Listener.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace OCA\Spreed\PublicShareAuth;
+use OCA\Spreed\Exceptions\ParticipantNotFoundException;
use OCA\Spreed\Participant;
use OCA\Spreed\Room;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -92,15 +93,15 @@ class Listener {
return;
}
- $participants = $room->getParticipants();
- $users = $participants['users'];
- $guests = $participants['guests'];
-
- if (array_key_exists($userId, $users) && $users[$userId]['participantType'] === Participant::OWNER) {
- return;
+ try {
+ $participant = $room->getParticipant($userId);
+ if ($participant->getParticipantType() === Participant::OWNER) {
+ return;
+ }
+ } catch (ParticipantNotFoundException $e) {
}
- if (\count($users) > 1 || \count($guests) > 0) {
+ if ($room->getActiveGuests() > 0 || \count($room->getParticipantUserIds()) > 1) {
throw new \OverflowException('Only the owner and another participant are allowed in rooms to request the password for a share');
}
}
@@ -119,11 +120,7 @@ class Listener {
return;
}
- $participants = $room->getParticipants();
- $users = $participants['users'];
- $guests = $participants['guests'];
-
- if (\count($users) > 1 || \count($guests) > 0) {
+ if ($room->getActiveGuests() > 0 || \count($room->getParticipantUserIds()) > 1) {
throw new \OverflowException('Only the owner and another participant are allowed in rooms to request the password for a share');
}
}