Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
edc54ea
Add support for public shares to file rooms
danxuliu Jul 18, 2018
8de6a11
Add integration tests for files shared by link
danxuliu Aug 14, 2019
3d89459
Add integration tests for self-joined users in files shared by link
danxuliu Aug 14, 2019
b10313c
Add self-joined users and guests to the candidate mentions in file rooms
danxuliu Aug 14, 2019
6bb86a4
Add integration tests for mentions in a file shared by link
danxuliu Aug 14, 2019
ca62f9d
Fix avatar container height during calls
danxuliu Sep 16, 2019
1ba0f4f
Add support for Talk sidebar in public share pages
danxuliu Aug 15, 2019
255ac5d
Add basic acceptance tests for the Talk sidebar in the public share page
danxuliu Aug 16, 2019
83b5469
Add acceptance tests for Talk sidebar in public share page to Drone
danxuliu Aug 16, 2019
aaa8b84
Add acceptance tests for registered users in the public share page
danxuliu Aug 16, 2019
cd17e48
Add acceptance tests for mentioning users in the Files app
danxuliu Aug 16, 2019
c03ab40
Add acceptance tests for mentions in the public share page
danxuliu Aug 16, 2019
7f731bd
Add acceptance tests for chats in a file shared by link
danxuliu Aug 16, 2019
b4a2907
Add acceptance tests for chats in a file shared by link with a password
danxuliu Aug 16, 2019
41a1556
Correctly check if the share has a password and if it was entered cor…
nickvergessen Aug 16, 2019
b77d4b2
Add integration tests for getting the room for link share with password
danxuliu Aug 17, 2019
7fdcb46
Do not add system message for self joined users to file rooms
danxuliu Aug 19, 2019
6f8ac51
Add integration tests for the "user_added" system message
danxuliu Aug 19, 2019
129a3c1
Add wrapper around "OC.getCurrentUser()" to be able to override the user
danxuliu Sep 25, 2019
c1e6687
Override the current user when getting the room for a public share page
danxuliu Sep 25, 2019
891a73f
Fix guest avatars in public share page
danxuliu Sep 25, 2019
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
Add integration tests for self-joined users in files shared by link
Self-joined users and guests can join the room for a file if the file is
shared by link. In order to check that, however, the share token should
have been previously stored in the session, as the room is linked to the
file id and users without direct access to a file can not find out if
the file is shared by link or not. Therefore self-joined users and
guests must get the room for the share (which stores the share token in
the session) before being able to join the room.

Besides that, in the case of self-joined users they must be logged in
too. Otherwise the session is regenerated on each new request, which
prevents getting the share token stored in a previous request.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Sep 26, 2019
commit 3d894598aecfefc28d041af9c6c0c1d75876fab7
45 changes: 45 additions & 0 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,51 @@ public function addingUserToGroup($user, $group) {
* Requests
*/

/**
* @Given /^user "([^"]*)" logs in$/
*/
public function userLogsIn(string $user) {
$loginUrl = $this->baseUrl . '/login';

$cookieJar = $this->getUserCookieJar($user);

// Request a new session and extract CSRF token
$client = new Client();
$this->response = $client->get(
$loginUrl,
[
'cookies' => $cookieJar,
]
);

$requestToken = $this->extractRequestTokenFromResponse($this->response);

// Login and extract new token
$password = ($user === 'admin') ? 'admin' : '123456';
$client = new Client();
$this->response = $client->post(
$loginUrl,
[
'body' => [
'user' => $user,
'password' => $password,
'requesttoken' => $requestToken,
],
'cookies' => $cookieJar,
]
);

$this->assertStatusCode($this->response, 200);
}

/**
* @param ResponseInterface $response
* @return string
*/
private function extractRequestTokenFromResponse(ResponseInterface $response): string {
return substr(preg_replace('/(.*)data-requesttoken="(.*)">(.*)/sm', '\2', $response->getBody()->getContents()), 0, 89);
}

/**
* @When /^sending "([^"]*)" to "([^"]*)" with$/
* @param string $verb
Expand Down
51 changes: 51 additions & 0 deletions tests/integration/features/conversation/files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ Feature: conversation/files
When user "participant2" joins room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

Scenario: user without access to a file shared by link can join its room
Given user "participant1" shares "welcome.txt" by link with OCS 100
# Users without access to a file shared by link need to log in (so further
# requests keep the same session) and get the room (so the share token is
# stored in the session) to be able to join it.
And user "participant2" logs in
And user "participant2" gets the room for last share with 200
When user "participant2" joins room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

Scenario: guest can join the room of a file shared by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "guest" gets the room for last share with 200
Expand Down Expand Up @@ -296,6 +306,18 @@ Feature: conversation/files
When user "participant2" leaves room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

Scenario: user without access to a file shared by link is removed from its room after leaving it
Given user "participant1" shares "welcome.txt" by link with OCS 100
# Users without access to a file shared by link need to log in (so further
# requests keep the same session) and get the room (so the share token is
# stored in the session) to be able to join it.
And user "participant2" logs in
And user "participant2" gets the room for last share with 200
And user "participant2" joins room "file last share room" with 200
And user "participant2" is participant of room "file last share room"
When user "participant2" leaves room "file last share room" with 200
Then user "participant2" is not participant of room "file last share room"

Scenario: guest is removed from the room of a file shared by link after leaving it
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "guest" gets the room for last share with 200
Expand Down Expand Up @@ -353,6 +375,20 @@ Feature: conversation/files
And user "participant2" joins room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

Scenario: user without access to a file shared by link can join its room again after removing self from it
Given user "participant1" shares "welcome.txt" by link with OCS 100
# Users without access to a file shared by link need to log in (so further
# requests keep the same session) and get the room (so the share token is
# stored in the session) to be able to join it.
And user "participant2" logs in
And user "participant2" gets the room for last share with 200
And user "participant2" joins room "file last share room" with 200
And user "participant2" is participant of room "file last share room"
When user "participant2" removes themselves from room "file last share room" with 200
And user "participant2" is not participant of room "file last share room"
And user "participant2" joins room "file last share room" with 200
Then user "participant2" is participant of room "file last share room"

# Guests can not remove themselves from a room.


Expand Down Expand Up @@ -409,6 +445,21 @@ Feature: conversation/files
And user "participant2" joins room "file last share room" with 200
And user "participant2" is participant of room "file last share room"

Scenario: user is not participant of room for file no longer shared by link and without access to it
Given user "participant1" shares "welcome.txt" by link with OCS 100
# Users without access to a file shared by link need to log in (so further
# requests keep the same session) and get the room (so the share token is
# stored in the session) to be able to join it.
And user "participant2" logs in
And user "participant2" gets the room for last share with 200
And user "participant2" joins room "file last share room" with 200
And user "participant2" leaves room "file last share room" with 200
And user "participant2" is not participant of room "file last share room"
When user "participant1" deletes last share
Then user "participant2" is not participant of room "file last share room"
And user "participant2" joins room "file last share room" with 404
And user "participant2" is not participant of room "file last share room"

Scenario: guest is not participant of room for file no longer shared by link
Given user "participant1" shares "welcome.txt" by link with OCS 100
And user "guest" gets the room for last share with 200
Expand Down