summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-07-14 15:37:42 +0200
committerGitHub <noreply@github.com>2016-07-14 15:37:42 +0200
commit813b58ab947222f983fe25d56781f1f43c840538 (patch)
treec61f76b18f464a4cf337ef0f242aee1af3f8fbbb
parentdc07ab0d26aed35a67063d6afafe375133a10b23 (diff)
parent268e65730a5dfc9f20b24240d1aedf6180beb9bb (diff)
downloadnextcloud-server-813b58ab947222f983fe25d56781f1f43c840538.tar.gz
nextcloud-server-813b58ab947222f983fe25d56781f1f43c840538.zip
Merge pull request #398 from nextcloud/issue-388-fix-hidden-file-list-master
Fix hidden file list master
-rw-r--r--apps/files_sharing/lib/API/Share20OCS.php11
-rw-r--r--build/integration/features/sharing-v1.feature35
-rw-r--r--core/js/sharedialoglinkshareview.js4
3 files changed, 43 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/API/Share20OCS.php b/apps/files_sharing/lib/API/Share20OCS.php
index 436b8d15ac8..9d7aeffcc1b 100644
--- a/apps/files_sharing/lib/API/Share20OCS.php
+++ b/apps/files_sharing/lib/API/Share20OCS.php
@@ -602,11 +602,12 @@ class Share20OCS {
}
if ($newPermissions !== null &&
- $newPermissions !== \OCP\Constants::PERMISSION_READ &&
- // legacy
- $newPermissions !== (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE) &&
- // correct
- $newPermissions !== (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE)
+ !in_array($newPermissions, [
+ \OCP\Constants::PERMISSION_READ,
+ \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE, // legacy
+ \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE, // correct
+ \OCP\Constants::PERMISSION_CREATE, // hidden file list
+ ])
) {
$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
return new \OC_OCS_Result(null, 400, $this->l->t('Can\'t change permissions for public share links'));
diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature
index 18dc3447594..75f98521e3a 100644
--- a/build/integration/features/sharing-v1.feature
+++ b/build/integration/features/sharing-v1.feature
@@ -103,6 +103,7 @@ Feature: sharing
| shareType | 3 |
And Updating last share with
| expireDate | +3 days |
+ And the OCS status code should be "100"
And Getting info of last share
Then the OCS status code should be "100"
And the HTTP status code should be "200"
@@ -134,6 +135,7 @@ Feature: sharing
| shareType | 3 |
And Updating last share with
| password | publicpw |
+ And the OCS status code should be "100"
And Getting info of last share
Then the OCS status code should be "100"
And the HTTP status code should be "200"
@@ -164,6 +166,7 @@ Feature: sharing
| shareType | 3 |
And Updating last share with
| permissions | 7 |
+ And the OCS status code should be "100"
And Getting info of last share
Then the OCS status code should be "100"
And the HTTP status code should be "200"
@@ -186,6 +189,37 @@ Feature: sharing
| url | AN_URL |
| mimetype | httpd/unix-directory |
+ Scenario: Creating a new public share, updating its permissions for "hide file list"
+ Given user "user0" exists
+ And As an "user0"
+ When creating a share with
+ | path | FOLDER |
+ | shareType | 3 |
+ And Updating last share with
+ | permissions | 4 |
+ And the OCS status code should be "100"
+ And Getting info of last share
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And Share fields of last share match with
+ | id | A_NUMBER |
+ | item_type | folder |
+ | item_source | A_NUMBER |
+ | share_type | 3 |
+ | file_source | A_NUMBER |
+ | file_target | /FOLDER |
+ | permissions | 4 |
+ | stime | A_NUMBER |
+ | token | A_TOKEN |
+ | storage | A_NUMBER |
+ | mail_send | 0 |
+ | uid_owner | user0 |
+ | storage_id | home::user0 |
+ | file_parent | A_NUMBER |
+ | displayname_owner | user0 |
+ | url | AN_URL |
+ | mimetype | httpd/unix-directory |
+
Scenario: Creating a new public share, updating publicUpload option and getting its info
Given user "user0" exists
And As an "user0"
@@ -194,6 +228,7 @@ Feature: sharing
| shareType | 3 |
And Updating last share with
| publicUpload | true |
+ And the OCS status code should be "100"
And Getting info of last share
Then the OCS status code should be "100"
And the HTTP status code should be "200"
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index ff83b40e0a0..457a788d589 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -227,9 +227,9 @@
var $checkbox = this.$('.hideFileListCheckbox');
$checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');
- var permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ;
+ var permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_READ | OC.PERMISSION_DELETE;
if ($checkbox.is(':checked')) {
- permissions = OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE;
+ permissions = OC.PERMISSION_CREATE;
}
this.model.saveLinkShare({