Skip to content

Commit 9301da6

Browse files
committed
fixup! fix(SecureView): hide disfunctional *download* files action
1 parent a942a88 commit 9301da6

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

tests/features/bootstrap/RichDocumentsContext.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class RichDocumentsContext implements Context {
3030
private $fileIds = [];
3131
/** @var array List of templates fetched for a given file type */
3232
private $templates = [];
33+
private array $directoryListing = [];
3334

3435
/** @BeforeScenario */
3536
public function gatherContexts(BeforeScenarioScope $scope) {
@@ -75,6 +76,22 @@ public function userOpens($user, $file) {
7576
Assert::assertNotEmpty($this->wopiToken);
7677
}
7778

79+
/**
80+
* @When User :user lists :folder
81+
*/
82+
public function userListsDirectory($user, $folder) {
83+
$this->directoryListing = [];
84+
$this->serverContext->usingWebAsUser($user);
85+
$this->directoryListing = $this->filesContext->listFolder($folder, 1, ['{http://nextcloud.org/ns}hide-download']);
86+
}
87+
88+
/**
89+
* @When file :file :canOrCannot be downloaded
90+
*/
91+
public function fileCanOrCannotBeDownlowded(string $file, string $canOrCannot): void {
92+
var_dump($this->directoryListing);
93+
}
94+
7895
public function generateTokenWithApi($user, $fileId, ?string $shareToken = null, ?string $path = null, ?string $guestName = null) {
7996
$this->serverContext->usingWebAsUser($user);
8097
$this->serverContext->sendJSONRequest('POST', '/index.php/apps/richdocuments/token', [

tests/features/secure-view.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Feature: API
2+
3+
Background:
4+
Given user "user1" exists
5+
6+
Scenario: Open a file in a folder shared by link
7+
Given as user "user1"
8+
And User "user1" creates a folder "NewFolder"
9+
And User "user1" uploads file "./../emptyTemplates/template.odt" to "/NewFolder/file.odt"
10+
And as "user1" create a share with
11+
| path | /NewFolder |
12+
| shareType | 3 |
13+
When User "user1" lists "/NewFolder/"
14+
Then file "file.odt" can be downloaded
15+
And Using web as guest
16+
#And a guest
17+
#And checkFileInfo "UserId" matches "/Guest-/"
18+
#Then download "is" prevented by Secure View

tests/run-integration.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ PHPPIDB=$!
5050

5151
$OCC config:app:set richdocuments wopi_url --value="http://localhost:9980"
5252
$OCC config:app:set richdocuments public_wopi_url --value="http://localhost:9980"
53+
$OCC config:app:set files watermark_enabled --value="yes"
54+
$OCC config:app:set files watermark_shareAll --value="yes"
5355
$OCC richdocuments:activate-config
5456
$OCC config:system:set allow_local_remote_servers --value true --type bool
5557
$OCC config:system:set gs.trustedHosts 0 --value="localhost:$PORT_SERVERA"
5658
$OCC config:system:set gs.trustedHosts 1 --value="localhost:$PORT_SERVERB"
5759

58-
5960
vendor/bin/behat $SCENARIO_TO_RUN
6061
RESULT=$?
6162

0 commit comments

Comments
 (0)