server
server copied to clipboard
Nested sharing could only lower the access rights
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
- Create folder1 and test.txt in it;
- Give some user read-only permissions to folder;
- 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
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.