зеркало из https://github.com/nextcloud/spreed.git
Merge pull request #3759 from nextcloud/bugfix/noid/bring-back-session-expiration-that-was-dropped-with-room-v2-api
Bring back session expiration
This commit is contained in:
Коммит
9db6e52f16
|
@ -843,10 +843,15 @@ class RoomController extends AEnvironmentAwareController {
|
|||
return new DataResponse([], Http::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
$maxPingAge = $this->timeFactory->getTime() - 100;
|
||||
$participants = $this->room->getParticipantsLegacy();
|
||||
$results = [];
|
||||
|
||||
foreach ($participants['users'] as $userId => $participant) {
|
||||
if ($participant['sessionId'] !== '0' && $participant['lastPing'] <= $maxPingAge) {
|
||||
$this->room->leaveRoom($userId);
|
||||
}
|
||||
|
||||
$user = $this->userManager->get((string) $userId);
|
||||
if (!$user instanceof IUser) {
|
||||
continue;
|
||||
|
@ -864,7 +869,12 @@ class RoomController extends AEnvironmentAwareController {
|
|||
}
|
||||
$guestNames = $this->guestManager->getNamesBySessionHashes($guestSessions);
|
||||
|
||||
$cleanGuests = false;
|
||||
foreach ($participants['guests'] as $participant) {
|
||||
if ($participant['lastPing'] <= $maxPingAge) {
|
||||
$cleanGuests = true;
|
||||
}
|
||||
|
||||
$sessionHash = sha1($participant['sessionId']);
|
||||
$results[] = array_merge($participant, [
|
||||
'userId' => '',
|
||||
|
@ -872,6 +882,10 @@ class RoomController extends AEnvironmentAwareController {
|
|||
]);
|
||||
}
|
||||
|
||||
if ($cleanGuests) {
|
||||
$this->room->cleanGuestParticipants();
|
||||
}
|
||||
|
||||
return new DataResponse($results);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче