Failing restrictions on sharing folder structures
Steps to reproduce
- Create group A with users a11, a12, a21, a22
- Create group A1 with users a11, a12 and group A2 with users a21, a22 as members (rendering each of them de facto as a distinct subgroup of A)
- Create folder Alpha and
- Create folders folderA1 and folderA2 and folderA3 in Alpha (Alpha/folderA1, Alpha/folderA2, Alpha/folderA3)
- Share folder Alpha with group A
- Share folder Alpha/folderA1 with group A1
- Share folder Alpha/folder A2 with group A2
Expected behaviour
I would expect Nextcloud to enforce the control on every depth of a directory tree. So, if I configure Nextcloud to share Alpha with everybody in group A it's perfectly fine to share access to Alpha to a11, a12, a21 and a22. Nevertheless A1 should now be able to access Alpha/folderA1 and Alpha/folderA3 but not Alpha/folderA2 because a distinct subgroup was selected for it. As well a21 and a21 shouldn't be able to access Alpha/folderA1 but should be able to access Alpha/folderA2 and Alpha/folderA3.
Actual behaviour
In contrast all users of group A are able to access Alpha/folderA1, Alpha/folderA2 and Alpha/folderA3. Though I can imagine why it is that way making a step backward it is illogic because in the “direct“ shares a21 and a22 can't access folderA1 and a11 and a12 can't access folderA2.
Additionally it is not possible to selectively share a structured directory tree with permissions (a consuming Android client will have to see a abundance of “flat top level shares“ on the root level not a cleaner and better manageable/navigateable hierarchical directory tree. And it leads in the end to many sub-shares (we're forced to rearrange and add folders to mimic the group partitions). This is substantially different to the behaviour of other tools like file systems, e.g. RaiserFS, Windows CIFS shares, or cloud sharing tools, e.g. Synology.
Server configuration
Operating system: Centos 7
Web server: Apache 2
Database: Postgres 9
PHP version: PHP 7
Nextcloud version: 13
Updated from an older Nextcloud/ownCloud or fresh install: Updated from 12
I would expect Nextcloud to enforce the control on every depth of a directory tree. So, if I configure Nextcloud to share Alpha with everybody in group A it's perfectly fine to share access to Alpha to a11, a12, a21 and a22. Nevertheless A1 should now be able to access Alpha/folderA1 and Alpha/folderA3 but not Alpha/folderA2 because a distinct subgroup was selected for it. As well a21 and a21 shouldn't be able to access Alpha/folderA1 but should be able to access Alpha/folderA2 and Alpha/folderA3.
Due to how our sharing system works this is not easily possible to check on every depth of the tree which permissions are given, because it means that we need to check the permissions of every parent directory then. It would mean a lot of computing work and was like this in the past. It cause major performance issues. Thus the sharing was reworked and is now done like it was described here.
If you share a folder A with read permission and a folder A/B with write permissions the recipient will have two shares: A with read only mode and another share B with the write permission.
cc @nextcloud/sharing Correct me if I'm wrong.
Thus I will close this as "works how it was designed".