Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 5 additions & 4 deletions apps/files_sharing/api/share20ocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function deleteShare($id) {
}
}

if (!$this->canAccessShare($share)) {
if (!$this->canAccessShare($share, false)) {
return new \OC_OCS_Result(null, 404, 'could not delete share');
}

Expand Down Expand Up @@ -564,7 +564,7 @@ public function updateShare($id) {
}
}

if (!$this->canAccessShare($share)) {
if (!$this->canAccessShare($share, false)) {
return new \OC_OCS_Result(null, 404, 'wrong share Id, share doesn\'t exist.');
}

Expand Down Expand Up @@ -669,9 +669,10 @@ public function updateShare($id) {

/**
* @param \OCP\Share\IShare $share
* @param bool $checkGroups
* @return bool
*/
protected function canAccessShare(\OCP\Share\IShare $share) {
protected function canAccessShare(\OCP\Share\IShare $share, $checkGroups = true) {
// A file with permissions 0 can't be accessed by us. So Don't show it
if ($share->getPermissions() === 0) {
return false;
Expand All @@ -690,7 +691,7 @@ protected function canAccessShare(\OCP\Share\IShare $share) {
return true;
}

if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
if ($checkGroups && $share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
$sharedWith = $this->groupManager->get($share->getSharedWith());
if ($sharedWith->inGroup($this->currentUser)) {
return true;
Expand Down
15 changes: 15 additions & 0 deletions build/integration/features/sharing-v1.feature
Original file line number Diff line number Diff line change
Expand Up @@ -594,3 +594,18 @@ Feature: sharing
| /foo/ |
| /foo%20(2)/ |

Scenario: Deleting a group share as user
Given As an "admin"
And user "user0" exists
And user "user1" exists
And group "group1" exists
And user "user1" belongs to group "group1"
And As an "user0"
And creating a share with
| path | welcome.txt |
| shareType | 1 |
| shareWith | group1 |
When As an "user1"
And Deleting last share
Then the OCS status code should be "404"
And the HTTP status code should be "200"