diff options
author | Joas Schilling <coding@schilljs.com> | 2021-09-22 13:37:20 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-10-07 19:18:30 +0300 |
commit | 390ae657a18523bb0b39f6531fa27de9bb075410 (patch) | |
tree | 1782ae950637d44d033e3a3b6f112ff4b529a2e1 /lib/Service | |
parent | a0e1168db04100c153133a5fcb0d1440a2e22644 (diff) |
Introduce different layers for permissions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/ParticipantService.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 001aed0b7..04a6be2cf 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -147,26 +147,26 @@ class ParticipantService { return; } - $oldState = $attendee->getPublishingPermissions(); + $oldState = $participant->getPermissions(); - $event = new ModifyParticipantEvent($room, $participant, 'publishingPermissions', $newState, $oldState); - $this->dispatcher->dispatch(Room::EVENT_BEFORE_PARTICIPANT_PUBLISHING_PERMISSIONS_SET, $event); + $event = new ModifyParticipantEvent($room, $participant, 'permissions', $newState, $oldState); + $this->dispatcher->dispatch(Room::EVENT_BEFORE_PARTICIPANT_PERMISSIONS_SET, $event); - $attendee->setPublishingPermissions($newState); + $attendee->setPermissions($newState); $this->attendeeMapper->update($attendee); - $this->dispatcher->dispatch(Room::EVENT_AFTER_PARTICIPANT_PUBLISHING_PERMISSIONS_SET, $event); + $this->dispatcher->dispatch(Room::EVENT_AFTER_PARTICIPANT_PERMISSIONS_SET, $event); } public function updateAllPermissions(Room $room, string $mode, int $newState, bool $includeModerators): void { // FIXME Add events after checking what should be sent to the HPB - // $event = new ModifyParticipantEvent($room, $participant, 'publishingPermissions', $newState, $oldState); - // $this->dispatcher->dispatch(Room::EVENT_BEFORE_PARTICIPANT_PUBLISHING_PERMISSIONS_SET, $event); + // $event = new ModifyParticipantEvent($room, $participant, 'permissions', $newState, $oldState); + // $this->dispatcher->dispatch(Room::EVENT_BEFORE_PARTICIPANT_PERMISSIONS_SET, $event); - $this->attendeeMapper->modifyPublishingPermissions($room->getId(), $mode, $newState, $includeModerators); + $this->attendeeMapper->modifyPermissions($room->getId(), $mode, $newState, $includeModerators); // FIXME Add events after checking what should be sent to the HPB - // $this->dispatcher->dispatch(Room::EVENT_AFTER_PARTICIPANT_PUBLISHING_PERMISSIONS_SET, $event); + // $this->dispatcher->dispatch(Room::EVENT_AFTER_PARTICIPANT_PERMISSIONS_SET, $event); } public function updateLastReadMessage(Participant $participant, int $lastReadMessage): void { @@ -871,11 +871,11 @@ class ParticipantService { return; } - $publishingPermissions = $participant->getAttendee()->getPublishingPermissions(); - if (!($publishingPermissions & Attendee::PERMISSIONS_PUBLISH_AUDIO)) { + $permissions = $participant->getPermissions(); + if (!($permissions & Attendee::PERMISSIONS_PUBLISH_AUDIO)) { $flags &= ~Participant::FLAG_WITH_AUDIO; } - if (!($publishingPermissions & Attendee::PERMISSIONS_PUBLISH_VIDEO)) { + if (!($permissions & Attendee::PERMISSIONS_PUBLISH_VIDEO)) { $flags &= ~Participant::FLAG_WITH_VIDEO; } @@ -916,11 +916,11 @@ class ParticipantService { throw new \InvalidArgumentException('Invalid flags'); } - $publishingPermissions = $participant->getAttendee()->getPublishingPermissions(); - if (!($publishingPermissions & Attendee::PERMISSIONS_PUBLISH_AUDIO)) { + $permissions = $participant->getPermissions(); + if (!($permissions & Attendee::PERMISSIONS_PUBLISH_AUDIO)) { $flags &= ~Participant::FLAG_WITH_AUDIO; } - if (!($publishingPermissions & Attendee::PERMISSIONS_PUBLISH_VIDEO)) { + if (!($permissions & Attendee::PERMISSIONS_PUBLISH_VIDEO)) { $flags &= ~Participant::FLAG_WITH_VIDEO; } |