-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] allow user/API to set file_target for a share #12548
Comments
It also works if i set |
It works with those changes for share creation via API: Still requires a fix for the indentation and tests, but I have troubles with the setup for the testing enviroment:
return following Error:
If I set "installed" to true in the config.php, it fails for the missing Database tables. |
Nice ! how are you handling the case where subdir doesnt exist in the remote user homedir ? the shared file/dir ends up in the homedir root i guess ? |
if the subdir doesn't exist, it will be moved automatically (already in implemented in Nextcloud ) to the root or the configured "'share_folder" (can be set in config.php for default target for all shares). |
Great ! Will make sure to test it as i plan to extensively use that feature. |
@landryb How did your tests go? Did you stumble over any issues? |
sadly i've been unable to test it yet :/ |
Well, we have it still running without any issues. |
But this one doesn't work as far as I know, since Nextcloud doesn't show shares in other shares. Since we generate the shares most of the time via the API, we always try to optimize the displayed shares for the user: If he has already access to the parent folder with the same rights, then we ignore/remove the share for the subfolder. If the parentfolder share is removed we recover the share for the subfolder. |
Fwiw, i've (finally!) tested mhq-services@a9ae3d9 locally on stable15 branch and it works fine, would be nice to get that into the next release as its an api change.. |
After testing it a bit more, there's some codepaths where the modified |
Digging more in the code, https://github.com/nextcloud/server/blob/master/apps/files_sharing/lib/SharedMount.php#L110 is where the new sub-entries get the 'wrong' file target without subdirs. But i agree maybe i'm asking too much, as i want the shares to appear in subdirectories, and that doesnt seem supported at all in the current code layout, sadly. |
I think i understand whats' wrong.. and it's a bit complicated. I'm trying to set file_target to point at a subdir of another existing groupshare, and verifyMountPoint fails to check that '/share/foo/bar' exists as the dir doesnt seem to exist (https://github.com/nextcloud/server/blob/master/apps/files_sharing/lib/SharedMount.php#L97 returns false) from the pov of the recipientView object - which is weird, as it's shown in the recipient folder list... |
Right, there was a problem, totally forgot about it. But yeah, thats the reason why we don't use group shares directly. Instead we create single shares for each member of the group. |
My (horrible) workaround so far is to hack VerifyMountPoint and avoid calling
but that feels soooo fragile.. |
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
Please use the groupfolder app for this. Thanks! |
we .. already use groupfolders, but that cant scale for the usecase we have, and that isnt the same feature as setting the |
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
…th a / (nextcloud#12548) needed by craig/autoshare#15 when we explicitely set file_target to present file in a subdir.
Right now, the
file_target
field in theoc_share
table is more or less internal, only updated (afaict after looking at the code) by changing mount points for shared mounts. I havent found many calls tosetTarget
andupdateFileTarget
is internal to files_sharing app.It would be interesting to have a way to control this value via the API (as a user via the UI, it would be an advanced feature) via a new
sharePath
parameter as it would allow the admin/person sharing to 'place' the shared file in a specific subdir in the remote user hierarchy. Right now i can do it by setting the value directly in the database but that feels hackish.Of course that implies access controls (ie can you 'write' in the given remote subdir, etc..) but as an admin who has to share billions of files to ~1k users (different subset of files for each users of course, but lots of overlap, ie some files will be shared to 10+ users, and i need to do it programatically), i plan to (abuse? misuse?) use this "feature" to "present" them a hierarchy i would control in a group folder shared with them. Avoiding thousands of files at the root of their homedir...
So far i've tested the following scenarios, with a file shared from user A to user B:
/path/file
,/path
being a dir local to the B user account -> file is displayed to B under/path
as expected/groupfolder/file
,/groupfolder
being a group folder seen as an external mount (created with the groupfolder API) -> file is displayed to B under/groupfolder
as expected, but not to user C (who also has access to the shared groupfolder) - would need to set an extra share for each user in that group ?/nonexistent/file
, file is displayed to B at the root of his homedir, and file_target is fixed in the db (ie comes back to/file
), so this 'broken' case (ie trying to share a file in a wrong/nonexistent dir) is gracefully handledsame tests when sharing a folder produced similar results.
The text was updated successfully, but these errors were encountered: