server icon indicating copy to clipboard operation
server copied to clipboard

Nested sharing could only lower the access rights

Open Irillit opened this issue 6 years ago • 1 comments

Mostly I wonder is it a bug or feature? Is there any special reason Nextcloud work like that? And are there any changes in next releases?

Steps to reproduce

  1. Create folder1 and test.txt in it;
  2. Give some user read-only permissions to folder;
  3. Give the same user write prmissions to test.txt;

Expected behaviour

User should be able to write into file. The closest sharing option should be selected.

Actual behaviour

User has read-only access to file.

Cause

In Cache.php of files_sharing application there is an entry:

if (isset($entry['permissions'])) {
    $entry['permissions'] &= $sharePermissions;
} else {
    $entry['permissions'] = $sharePermissions;
}

If you change AND (&=) to OR (|=), you'll not be able to forbid user something inside the shared folder. Is there any reason why we can't use $entry['permissions'] to the file?

Nextcloud version: 16

Irillit avatar Jan 20 '20 12:01 Irillit

I could reproduce this on NC21.0.2. So most likely we should hide edit permissions for this user when sharing a file inside a folder with him/her.

szaimen avatar Jun 07 '21 16:06 szaimen