i have written a small nextcloud plugin for filtering mimetypes based on the files path and it can be configured with a config file ( https://apps.nextcloud.com/apps/files_staticmimecontrol / files_staticmimecontrol/StorageWrapper.php at main · Nagold/files_staticmimecontrol · GitHub ).
I’m by no means a php expert and this is my first nextcloud plugin, so most likeley you will be in pain if you analyze my code ( btw: if you can see bad practice or errors, i appreciate any hints!).
The plugin does everything like we imagined and does the job in every situation but one:
When we use a groupfolder and create a subfolder in the groupfolder, then suddenly the path of an uploaded file does not have the __groupfolders/ID prefix in every checkFileAccess call, but only the subfolders name as prefix and therefore the method working in the groupfolders root to match __groupfolders/ID does not work.
Also the mountpoint in this scenario turns to the mount point from a users perspective for example “/user1/files/testgroupfolder/” and not “__groupfolders/1/testgroupfolder” as i would expect it.
I have tried to somehow find out how to get to the groupfolder id or path via the objects i have access to, but the debugger shows only 2 places (from point of view of the OCA\FilesStaticmimecontrol\StorageWrapper):
1: $this->storage->storage->storage->OCA\GroupFolders\Mount\GroupFolderStoragefolderId (which i could not manage to access from the code)
2: $this->storage->storage->storage->storage->rootPath (which seems to be either protected or private)
Thanks to get_class($this->storage->storage->storage) i can determinate if the request at that moment depends on a groupfolder object or not, so i just either need to convert the groupfolders name to its id or directly receive the __groupfolders/ path from somewhere, to compare it against my rules.
I would really appreciate any help and any suggestions!
If i did not manage to explain my problem so you can understand it, also let me know.
Thanks in advance,