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>2021-02-08 22:55:52 +0300
committerJoas Schilling <coding@schilljs.com>2021-06-11 10:07:29 +0300
commit7631251c99ec6ec552e0d9a915e12b3e68087b05 (patch)
tree212961f4ece0ade34dd91d3366653239430cc759 /lib/Signaling
parent3b73e10ca482207bb24b2282ad4c93fb9004d5ed (diff)
Grant permissions in the HPB based on publishing permissions
When a participant does not have publishing permissions the HPB will block signaling messages related to establishing a connection, like sending the candidates. This would prevent participants using clients not supporting yet the publishing permissions (and thus still trying to publish even if they are not allowed to) from sending media in a call. Unfortunately the lack of permissions only prevents the connection from being established. If a participant is already sending media revoking the publishing permissions will not cause the connection to be stopped by the HPB. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib/Signaling')
-rw-r--r--lib/Signaling/BackendNotifier.php8
-rw-r--r--lib/Signaling/Listener.php8
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php
index 50f906c87..73b5d4c31 100644
--- a/lib/Signaling/BackendNotifier.php
+++ b/lib/Signaling/BackendNotifier.php
@@ -277,7 +277,13 @@ class BackendNotifier {
$users[] = $data;
if (\in_array($session->getSessionId(), $sessionIds, true)) {
- $data['permissions'] = ['publish-media', 'publish-screen'];
+ $data['permissions'] = [];
+ if ($attendee->getPublishingPermissions() & (Attendee::PUBLISHING_PERMISSIONS_AUDIO | Attendee::PUBLISHING_PERMISSIONS_VIDEO)) {
+ $data['permissions'][] = 'publish-media';
+ }
+ if ($attendee->getPublishingPermissions() & Attendee::PUBLISHING_PERMISSIONS_SCREENSHARING) {
+ $data['permissions'][] = 'publish-screen';
+ }
if ($attendee->getParticipantType() === Participant::OWNER ||
$attendee->getParticipantType() === Participant::MODERATOR) {
$data['permissions'][] = 'control';
diff --git a/lib/Signaling/Listener.php b/lib/Signaling/Listener.php
index 9ebec18bd..e6213e5d0 100644
--- a/lib/Signaling/Listener.php
+++ b/lib/Signaling/Listener.php
@@ -130,7 +130,8 @@ class Listener {
// "participantsModified" once the clients no longer expect a
// "roomModified" message for participant type changes.
$dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, $listener);
- $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function (ModifyParticipantEvent $event) {
+
+ $listener = static function (ModifyParticipantEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -151,7 +152,10 @@ class Listener {
}
$notifier->participantsModified($event->getRoom(), $sessionIds);
- });
+ };
+ $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, $listener);
+ $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_PUBLISHING_PERMISSIONS_SET, $listener);
+
$dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DELETE, static function (RoomEvent $event) {
if (self::isUsingInternalSignaling()) {
return;