diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-03-14 03:07:20 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-03-17 16:04:10 +0300 |
commit | 0c89ca0fb1ed497ca358c01344bbce6cdc671026 (patch) | |
tree | 62e08cc404a8012d0da1d557e87f032358ff42d2 /lib | |
parent | a99b210be323436ec1c58a4d148aea8c810479d6 (diff) |
Fix permissions not updated in HPB when general permissions change
When the room or call permissions are set the permissions of all
participants could be modified. However, in this case the signaling
permissions were not updated, so the signaling server could allow or
reject media from participants that were already in the room when the
permissions changed. Now a message to update all the participants
currently in the room is sent to the signaling server when the room or
call permissions are set.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Signaling/Listener.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/Signaling/Listener.php b/lib/Signaling/Listener.php index 2452729f8..1c5844235 100644 --- a/lib/Signaling/Listener.php +++ b/lib/Signaling/Listener.php @@ -158,6 +158,40 @@ class Listener { $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, $listener); $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_PERMISSIONS_SET, $listener); + $dispatcher->addListener(Room::EVENT_AFTER_PERMISSIONS_SET, static function (RoomEvent $event) { + if (self::isUsingInternalSignaling()) { + return; + } + + /** @var BackendNotifier $notifier */ + $notifier = \OC::$server->get(BackendNotifier::class); + + $sessionIds = []; + + // Setting the room permissions resets the permissions of all + // participants, even those with custom attendee permissions. + + // FIXME This approach does not scale, as the update message for all + // the sessions in a conversation can exceed the allowed size of the + // request in conversations with a large number of participants. + // However, note that a single message with the general permissions + // to be set on all participants can not be sent either, as the + // general permissions could be overriden by custom attendee + // permissions in specific participants. + + /** @var ParticipantService $participantService */ + $participantService = \OC::$server->get(ParticipantService::class); + $participants = $participantService->getSessionsAndParticipantsForRoom($event->getRoom()); + foreach ($participants as $participant) { + $session = $participant->getSession(); + if ($session) { + $sessionIds[] = $session->getSessionId(); + } + } + + $notifier->participantsModified($event->getRoom(), $sessionIds); + }); + $dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DELETE, static function (RoomEvent $event) { if (self::isUsingInternalSignaling()) { return; |