-
Notifications
You must be signed in to change notification settings - Fork 2.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
Sharing does not work with custom Storages, expects oc_filecache #26607
Comments
|
Indeed, seems the share backends are still used in some places (from v9.1.2):
and from what I see those backend classes are using the old |
added to the main share 2.0 ticket: #22209 |
Let's see why the backends are used in these places:
Let's do some experimentation... |
|
Regarding the file/folder sharing backends, my findings so far:
So for now I'd say the goal is to find out how much of the sharing logic still goes through |
Here's an experimental PR that gets rid of the file/folder share backends: #26608 @labkode Since you're using OC 9, you might want to only comment them out and also adjust the "loadScripts" part, see the first commit and how it moves JS loading for shares to the template: 42ba7db#diff-f7a9bb6da381ad3d1651acb5f47162a1R149 @labkode and for the sharee (autocomplete), this might be needed to avoid errors: 8b2a6c4 So far on that PR manual sharing in the web UI still works but I haven't tested complex scenarios yet. |
After working on #26608 and checking the code paths a bit, I found that there are still places in the code that rely on |
... or the short-term alternative would be to make these share backends use the node API and share 2.0 API when possible. But long-term I'd like to kill these. |
So, in this PR #26608 the occurrences of filecache are already reduced:
(DefaultShareProvider can be ignored) Still a lot of work to do to make most of the OC code rely on the new Share API. |
Now let's make a nice list of todos:
Once all these are done there should be no trace left of filecache in the sharing code. (separate apps might have their own though, like activity, etc) |
Just a few remarks to give more light to the problem: Sharing via link works, I can access shared folders with no problems with our custom storage. Example of the problem:
Our code base is based on stable9.1 not on master so merging your code gives lot of conflicts. What I have done is just cherry picked the commit 42ba7db and the UI and share via link continue to work, user and groups shares still not. |
@labkode please debug into 'ShareManager::getSharedWith()` from https://github.com/owncloud/core/blob/v9.1.2/apps/files_sharing/lib/MountProvider.php#L70 and see why it doesn't return any results for you. |
@PVince81
The scenario is the following:
I went to the file responsible for this:
What is supposed to be returned in the getStorageId() for the mount?
How can I avoid using this table in ownCloud 9.1 based on IStorage? What I should return from the getStorageId method? Thanks in advance |
The value of It might be possible to skip using How many storage implementations do you have ? If you only have a single one you might be able to simply return a dummy id like "1" every time and be done with it. |
These are some examples from prod oc_storages
In my dev setup I have these:
And these two entries were created before enabling our own storage. So, after enabling it nothing has been inserted to this table, not even shared::* entries. Can this be the primary source of the sharing problem ? so shared stuff do not appear because the mount point is not listed in this table? And if so, that means that there is a hardcoded dependency at some place to insert shared::* entries into the oc_storage table and that requirement is not gathered into the sharing interfaces. |
We only use one, I'll try with that, but then it will be the same for all users right? And in that case, I don't understand why it is stored in oc_storage per user and in previous examples |
This folder |
The "oc_storages" is not supposed to have any "shared::" entries for local shares, only fed shares. There was a bug in 9.0 where bogus entries were added. Did you try debugging into #26607 (comment) ? The received share mount points are dynamic and only get setup if your sharing code properly returns the "shared with you" entries. Since you said that even "shared with you" has no results, then shared mount points will not appear. So first would be to find out why no results are returned. |
I checked that area and my share provider is returning the shares, but nothing shows in the UI, so they get discarded in the way up. So, the problem must be in the code calling getMountsForUser or that ownCloud expects some behaviours/structure in the fields of the share and I am not replying them correctly |
Okay, weird... I commented out this line but the mount points still work: https://github.com/owncloud/core/blob/v9.1.2/lib/private/Files/Filesystem.php#L443 Actually I think the real registration of mounts for local use is done two lines above: https://github.com/owncloud/core/blob/v9.1.2/lib/private/Files/Filesystem.php#L441 With a breakpoint there, this is what I see when evaluating "self::$mounts":
"test" is the received share. Apparently no storage id is needed there. Does your |
Thanks a lot for the input, |
here is the output, the only difference my eye could spot is that I use my IShare implementation (\OC\CernBox\Share\Share) instead yours. I also expanded the file info so you can see our ICacheEntry implementation and the data it contains:
|
Hmmm, that looks fine to me. If you do a PROPFIND on this "ONE" folder directly for the receiving user even though it's not visible, do you get a result or 404 ? Next step would be do debug into https://github.com/owncloud/core/blob/v9.1.2/lib/private/Files/Mount/Manager.php#L73 and evaluate the |
I tried with the original file name ONE and with the file target ONE (#6697304) and both results give back 404. In the second request, at least the file target was resolved to the resource name of the share owner.
|
To be clear with the scenario:
This is how the mounts look like for the shared folder when examinating the break point at:
The evaluation of \OC\Files\Filesystem::$mounts gives same results:
Reading your previous comment, which mount should I have?
|
If the share mountpoint would be mounted correctly, the Ok, so the result you posted means we should debug in the code that is executed between the |
@PVince81 Does it gives you some hint? Else I will start debugging the creation of the Shared mount.
|
What do you mean with parent find ? Mount manager find on the parent folder ? |
Hi, When I do a PROPFIND on my home directory, inside the find method I see that for paths /labrador/ and /labrador/files/ I have this mount point: If I do the PROPFIND or MKCOL on
In my previous comment I told you that PROPFINDing /ONE (#6697304) gave me 404, but that was because I did not URL encoded correctly, stupid me :( |
Hi,
Although the shared folser appears in the All files tab when I click on the Shared with you tab there aren't shares. When I see the details of the Shared folder from the All files tab, I got 'Resharing is not allowed' . I debugged what was going on when clicking on the Shared with you tab and I discovered that shares were not returned because they could not be resolved because of following: This line calls the formatShare method but a NotFound exception is triggered. The problem resides here: Based on my previous example (gonzalhu shared /ONE with user labradorsvc), The way I understand this is that your $userFolder (\OCP\Files\Folder, "Returns a view to user's files folder") allows also to access files outside the user home folder and I think is completely wrong. The $userFolder should be created with the shareOwner, as this user is the one that has the folder with id = item_source. Please, check if there is something wrong in my explanation, Cheers |
No, I think the Share20OCS logic is correct. The response must be with the perspective of the currently logged in user so that the paths appear as they see them. For example:
If user2 queries the API they need to see the path as "/mytest", not the one from the original share. This is important to be able to map the shares to the results from the Webdav endpoint for example. In the regular OC impl if you call So either your impl needs to change to return that item too. Or maybe something is missing and the item isn't mounted properly in this specific code path ? |
Hi, I found the problem and the solution. The problem arises due to a non handled exception here: The get method will throw a NotFoundException when asking for a path that does not exist. This exception will abort the traversal of the others mounts that have not been yet examined. And the second mount point in my case is exactly the SharedMount. The solution I put in place is this:
and sharing works both from 'Shared with you' and in the share view when accessing the details of the folder. I will create a PR for this. What I wonder is why you did not face this problem before? i.e. the exception is not triggered for you? |
I didn't test with any custom storages / shared storages, so I don't see how I could run into such exception. Or maybe it happens but is not visible because it is ignored ? Haven't digged into this piece of code. |
but great that you found the problem with a solution 😄 This whole thing is a bit obscure... Does the PHPDoc need updating to make sure implementers of the interface know that they need to do that ? |
@labkode it did work in the end, didn't it ? I'd like to close this ticket unless you have anything to add. |
@PVince81 Sure |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
@DeepDiver1975 @PVince81
We have our own implementation of the Sharing2.0 and we register it via config.php
'sharing.managerFactory' => 'OC\CernBox\Share\ProviderFactory',
So far, we can CRUD user, group and link shares from the sharing dialog and we haven't patched any class in ownCloud.
Now the problem resides when accessing the shared resources, as we cannot access them.
We think that the problem is that the sharing application still relies on filecache:
We have seen that:
are registered in
/apps/files_sharing/appinfo/app.php
and if you comment these lines sharing stop working, therefore there is a strong dependency on these classes that rely on filecache to work.
This a is a high priority item for us to have CERNBox totally plugable in ownCloud 9 and avoid dirty hacks we did in the past.
The text was updated successfully, but these errors were encountered: