Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix additional participants being able to join a password request room
This fixes a regression introduced in 4afa2d7.

The active guests are only those who are currently in a call, and not
those who are currently in the conversation. Therefore other guests or
users were not prevented from joining a password request conversation if
a guest was in the conversation but not in the call.

Fortunately in practice this was not a problem, as the Web UI starts a
call immediately after joining the conversation, which made the guest
immediately active and thus prevented others from joining.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Dec 18, 2020
commit 0b5bfe34afa0295f0bc7e2d55ddc165171548edd
6 changes: 2 additions & 4 deletions lib/PublicShareAuth/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ public static function preventExtraUsersFromJoining(Room $room, string $userId):
}

$participantService = \OC::$server->get(ParticipantService::class);
$users = $participantService->getParticipantUserIds($room);
if ($room->getActiveGuests() > 0 || \count($users) > 1) {
if ($participantService->getNumberOfActors($room) > 1) {
throw new \OverflowException('Only the owner and another participant are allowed in rooms to request the password for a share');
}
}
Expand All @@ -112,8 +111,7 @@ public static function preventExtraGuestsFromJoining(Room $room): void {
}

$participantService = \OC::$server->get(ParticipantService::class);
$users = $participantService->getParticipantUserIds($room);
if ($room->getActiveGuests() > 0 || \count($users) > 1) {
if ($participantService->getNumberOfActors($room) > 1) {
throw new \OverflowException('Only the owner and another participant are allowed in rooms to request the password for a share');
}
}
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ public function userJoinsRoom($user, $identifier, $statusCode, TableNode $formDa
);
$this->assertStatusCode($this->response, $statusCode);

if ($statusCode !== '200') {
return;
}

$response = $this->getDataFromResponse($this->response);
if (array_key_exists('sessionId', $response)) {
// In the chat guest users are identified by their sessionId. The
Expand Down
37 changes: 37 additions & 0 deletions tests/integration/features/conversation/password-request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Feature: conversation/password-request
Background:
Given user "participant1" exists
Given user "participant2" exists
Given user "participant3" exists

Scenario: create password-request room for file shared by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
Expand Down Expand Up @@ -74,6 +75,42 @@ Feature: conversation/password-request
And user "guest" creates the password request room for last share with 201
When user "participant1" joins room "password request for last share room" with 200

Scenario: other guests can not join the password request room when a guest already joined
Given user "participant1" shares "welcome.txt" by link with OCS 100
| password | 123456 |
| sendPasswordByTalk | true |
And user "guest" creates the password request room for last share with 201
And user "guest" joins room "password request for last share room" with 200
When user "guest2" joins room "password request for last share room" with 404
Then user "guest2" is not participant of room "password request for last share room"

Scenario: other guests can not join the password request room when a user already joined
Given user "participant1" shares "welcome.txt" by link with OCS 100
| password | 123456 |
| sendPasswordByTalk | true |
And user "participant2" creates the password request room for last share with 201
And user "participant2" joins room "password request for last share room" with 200
When user "guest" joins room "password request for last share room" with 404
Then user "guest" is not participant of room "password request for last share room"

Scenario: other users can not join the password request room when a guest already joined
Given user "participant1" shares "welcome.txt" by link with OCS 100
| password | 123456 |
| sendPasswordByTalk | true |
And user "guest" creates the password request room for last share with 201
And user "guest" joins room "password request for last share room" with 200
When user "participant2" joins room "password request for last share room" with 404
Then user "participant2" is not participant of room "password request for last share room"

Scenario: other users can not join the password request room when a user already joined
Given user "participant1" shares "welcome.txt" by link with OCS 100
| password | 123456 |
| sendPasswordByTalk | true |
And user "participant2" creates the password request room for last share with 201
And user "participant2" joins room "password request for last share room" with 200
When user "participant3" joins room "password request for last share room" with 404
Then user "participant3" is not participant of room "password request for last share room"



Scenario: guest leaves the password request room
Expand Down