diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-07-08 22:58:16 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-11-03 15:10:33 +0300 |
commit | cb2f6e2c18eee8263b3d939d776ea63a9f3504a8 (patch) | |
tree | cfa1b17f8c52deb50fb7b9da8e87a87ed2d54e47 /lib | |
parent | 2819892f317609a4a5fee86692e7ffa007a11730 (diff) |
Add button to end meeting for all
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/CallController.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php index 17f89d416..0cca8f991 100644 --- a/lib/Controller/CallController.php +++ b/lib/Controller/CallController.php @@ -157,15 +157,25 @@ class CallController extends AEnvironmentAwareController { * @PublicPage * @RequireParticipant * + * @param bool $all whether to also terminate the call for all participants * @return DataResponse */ - public function leaveCall(): DataResponse { + public function leaveCall(bool $all = false): DataResponse { $session = $this->participant->getSession(); if (!$session instanceof Session) { return new DataResponse([], Http::STATUS_NOT_FOUND); } - $this->participantService->changeInCall($this->room, $this->participant, Participant::FLAG_DISCONNECTED); + if ($all && $this->participant->hasModeratorPermissions()) { + $participants = $this->participantService->getParticipantsInCall($this->room); + + // kick out all participants out of the call + foreach ($participants as $participant) { + $this->participantService->changeInCall($this->room, $participant, Participant::FLAG_DISCONNECTED); + } + } else { + $this->participantService->changeInCall($this->room, $this->participant, Participant::FLAG_DISCONNECTED); + } return new DataResponse(); } |