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:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-03-05 22:41:29 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-03-06 16:53:24 +0300
commitc0c73d1e4998aef30ed93431afd1f526acb18d9e (patch)
tree92fe57934475a6252bc3cdeb5eece9059ffc64af /tests/php/Signaling/BackendNotifierTest.php
parent29e192164c5bde68115b5d2923b97e0831452ae1 (diff)
Send participant permissions to the external signaling server
In order to filter control messages the external signaling server needs to know the permissions of each participant. Those permissions need to be set when the participant joins the room or if the participant type is changed. All participants should have permissions to publish media and screen, but only logged in moderators should have permission to send control messages. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/php/Signaling/BackendNotifierTest.php')
-rw-r--r--tests/php/Signaling/BackendNotifierTest.php95
1 files changed, 93 insertions, 2 deletions
diff --git a/tests/php/Signaling/BackendNotifierTest.php b/tests/php/Signaling/BackendNotifierTest.php
index a2f6bcbe4..37676eabf 100644
--- a/tests/php/Signaling/BackendNotifierTest.php
+++ b/tests/php/Signaling/BackendNotifierTest.php
@@ -562,6 +562,7 @@ class BackendNotifierTest extends \Test\TestCase {
'participants' => [
'changed' => [
[
+ 'permissions' => ['publish-media', 'publish-screen', 'control'],
'inCall' => 0,
'lastPing' => 0,
'sessionId' => $userSession,
@@ -595,6 +596,7 @@ class BackendNotifierTest extends \Test\TestCase {
'participants' => [
'changed' => [
[
+ 'permissions' => ['publish-media', 'publish-screen'],
'inCall' => 0,
'lastPing' => 0,
'sessionId' => $guestSession,
@@ -624,8 +626,8 @@ class BackendNotifierTest extends \Test\TestCase {
$room->addUsers([
'userId' => $notJoinedUserId,
]);
- $participant = $room->getParticipant($notJoinedUserId);
- $room->setParticipantType($participant, Participant::MODERATOR);
+ $notJoinedParticipant = $room->getParticipant($notJoinedUserId);
+ $room->setParticipantType($notJoinedParticipant, Participant::MODERATOR);
$requests = $this->controller->getRequests();
$bodies = array_map(function($request) use ($room) {
@@ -660,6 +662,95 @@ class BackendNotifierTest extends \Test\TestCase {
],
],
], $bodies);
+
+ $this->controller->clearRequests();
+ $room->setParticipantType($participant, Participant::USER);
+
+ $requests = $this->controller->getRequests();
+ $bodies = array_map(function($request) use ($room) {
+ return json_decode($this->validateBackendRequest($this->baseUrl . '/api/v1/room/' . $room->getToken(), $request), true);
+ }, $requests);
+ $this->assertContains([
+ 'type' => 'participants',
+ 'participants' => [
+ 'changed' => [
+ [
+ 'permissions' => ['publish-media', 'publish-screen'],
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => $userSession,
+ 'participantType' => Participant::USER,
+ 'userId' => $this->userId,
+ ],
+ ],
+ 'users' => [
+ [
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => $userSession,
+ 'participantType' => Participant::USER,
+ 'userId' => $this->userId,
+ ],
+ [
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => 0,
+ 'participantType' => Participant::MODERATOR,
+ 'userId' => $notJoinedUserId,
+ ],
+ [
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => $guestSession,
+ 'participantType' => Participant::GUEST_MODERATOR,
+ ],
+ ],
+ ],
+ ], $bodies);
+
+ $this->controller->clearRequests();
+ $room->setParticipantType($guestParticipant, Participant::GUEST);
+
+ $requests = $this->controller->getRequests();
+ $bodies = array_map(function($request) use ($room) {
+ return json_decode($this->validateBackendRequest($this->baseUrl . '/api/v1/room/' . $room->getToken(), $request), true);
+ }, $requests);
+ $this->assertContains([
+ 'type' => 'participants',
+ 'participants' => [
+ 'changed' => [
+ [
+ 'permissions' => ['publish-media', 'publish-screen'],
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => $guestSession,
+ 'participantType' => Participant::GUEST,
+ ],
+ ],
+ 'users' => [
+ [
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => $userSession,
+ 'participantType' => Participant::USER,
+ 'userId' => $this->userId,
+ ],
+ [
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => 0,
+ 'participantType' => Participant::MODERATOR,
+ 'userId' => $notJoinedUserId,
+ ],
+ [
+ 'inCall' => 0,
+ 'lastPing' => 0,
+ 'sessionId' => $guestSession,
+ 'participantType' => Participant::GUEST,
+ ],
+ ],
+ ],
+ ], $bodies);
}
}