diff options
author | Vitor Mattos <vitor@php.rio> | 2022-04-25 19:47:57 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-04-25 19:47:57 +0300 |
commit | 41cbc76ae335e892704ce9f7b1c10ca05ca55a08 (patch) | |
tree | 5d8768d115fa9b2b44ac1a6aa6dd4ff3dc1b450c /lib | |
parent | e69c1252bdf890cb2bcffdc4a214531cc9f6c964 (diff) |
Move sharing listeners to staticfeature/move-sharing-listeners-anonymous-functions-to-static
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Listener/RestrictStartingCalls.php | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Listener/RestrictStartingCalls.php b/lib/Listener/RestrictStartingCalls.php index ed041ef0c..59e95639c 100644 --- a/lib/Listener/RestrictStartingCalls.php +++ b/lib/Listener/RestrictStartingCalls.php @@ -42,18 +42,16 @@ class RestrictStartingCalls { } public static function register(IEventDispatcher $dispatcher): void { - $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function (ModifyParticipantEvent $event) { - /** @var self $listener */ - $listener = \OC::$server->get(self::class); - $listener->checkStartCallPermissions($event); - }, 1000); + $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, [self::class, 'checkStartCallPermissions'], 1000); } /** * @param ModifyParticipantEvent $event * @throws ForbiddenException */ - public function checkStartCallPermissions(ModifyParticipantEvent $event): void { + public static function checkStartCallPermissions(ModifyParticipantEvent $event): void { + /** @var self $listener */ + $listener = \OC::$server->get(self::class); $room = $event->getRoom(); $participant = $event->getParticipant(); @@ -63,7 +61,7 @@ class RestrictStartingCalls { return; } - if (!$participant->canStartCall($this->config) && !$this->participantService->hasActiveSessionsInCall($room)) { + if (!$participant->canStartCall($listener->config) && !$listener->participantService->hasActiveSessionsInCall($room)) { throw new ForbiddenException('Can not start a call'); } } |