-
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
webUI to OCS Share API #17143
webUI to OCS Share API #17143
Conversation
A new inspection was created. |
} else { | ||
var msg = t('core', 'Error'); | ||
} | ||
OC.dialogs.alert(msg, t('core', 'Error')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no dialog - please use oc.notifications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, this is just old copied code... but you are right. Added to the TODO
Very nice! 👍 |
Nice idea. But keep in mind the as of today the OCS API is a files sharing api, located in the files_sharing app while the share dialog is in core and should also work without the files_sharing app, e.g. for calendar, contacts, etc. The first step would be to transform the OCS files sharing api to a general OCS sharing API in core if we want to use it as universal API for sharing. So probably the best way to deal with it is to implement it while we clean up the sharing code in core. |
Hmmm, it sounds rather that we should focus on the share panel integration in the right sidebar: #16308 To proceed, we could either rewrite the dialog from scratch or reuse the OC.Share code from core/js/share.js and refactor it into a new class/file. But leave the original one in place. This means that the new dialog/panel would use the OCS Share API already while the old dialog is left to use the ajax calls, until we can remove it (once calendar/contacts and co are adapted). @rullzer so what you could do now is make a copy of your changes and move them into a new class/file. |
Well - with the idea in mind (as discussed) to have a file-only sharing code in core we have to remove this old code pieces AND allocate time to help out on the apps to fix it with the app devs together. No need to hold back old crappy code - we basically already agreed on breaking this API the hard way in 8.2 @karlitschek FYI |
I agree with @DeepDiver1975 let's hold this back until we know how to move on with sharing in general. Just as a side note: I'm not sure if it is a good idea to have files-only sharing code in core. Currently I think more in the direction of what we have done with encryption 2.0. Have a general share API in core which provides the minimal share functionality which is the same for all share types and let apps register their "share provider" which gets then called from core and can handle all the share type specific parts. But that's something we need to discuss in detail before we move forward. Let's sit together during the ownCloud conference (if this fits our overall timetable for sharing) and come up with some first ideas, create a github issue with it and then move forward. |
Just to not forget this: caldav comes with thier own sharing mechanisms - might be worth to have a look at this ... |
Another problem: if we want to rewrite the share dialog inside the new sidebar (#17665), should the new one still use the old share APIs ? Or is it an opportunity to make it use the OCS share APIs already ? |
@DeepDiver1975 I had the feeling that the share info was already scheduled for 8.2 to be in the sidebar, so not sure if there will be time to discuss API stuff until then. Since the OCS Share API (file specific) is already there and deprecating it will take 3 years anyway, it might still be worth using it now instead of waiting for the Share API 2 redesign. @rullzer it just came to me that your PR will break calendar and contact sharing. |
@PVince81 yeah I know my change breaks calendar and contact sharing. What I think we should do in this case abstract away. So it is getting future proof. We should provide an OCS API class in core OCP.OCS, which allows basic OCS operations in core. This would allow proper parsing of return stuff etc. Then files sharing could just implement sharing for files in its own functions. Using OCP.OCS. (So calendar and contacts sharing use the old stuff). This leaves the interapp dependency issue. Since either we have specific sharing code in core or each app needs to implent sharing themself... On a related note if we break sharing and introduce sharing 2.0 this will hopefully be more generic. So then implementing sharing in your app would be a mater of picking the right share type ('file', 'contact' etc). and a uniq id (e.g. 'path'). But that is all to be discussed in Berlin. |
Ok that was a little less of a clear story then I would have liked :p @PVince81 in short I would say yes we should reuse parts. Since we officially do not allow inter app dependencies. So if we have an OCP.OCS in core we could just implement the files sharing js in the files_sharing app (which is better separation anyway). That way files sharing can use the OCS API. While leaving calender and contacts sharing working. |
As discussed today with @cmonteroluque , @MTRichards ,@DeepDiver1975 ,@karlitschek and @dragotin the server should be API-oriented and both APIs must converge into one, ant this one has to be the OCS Share API. The main problem of the internal Share API is the inefficiency of the operations because they are file ID based and not share ID based like the OCS API. See this example of deleting a share: This example illustrates the differences:
OCS Share
When retrieving information about a share both APIs offer the same result: Internal share
OCS API
and both suffer the same problem. The storage field is retrieved along with the share information after doing a JOIN over the oc_filecache. OwnCloud suffers the problem of being relative-path based to the common virtual filesystem, so every operation that use a path, internally must resolve this path to the corresponding storage. I will clarify this design aspect in the draft we are working to present to you as we agreed. Cheers |
Blocked by #18185 |
Let me close this PR. As we should do it all properly in the item model now anyway. |
Currently the web interface uses the ajax/share.php endpoint to do all its sharing magic. Of course this should also use the OCS Share API so there is only 1 code path to maintain.
This PR aims to move the webUI to the OCS Share API. Most stuff is done
Done:
Todo:
Currently I created a new file ocs-share.js to make share.js a bit less messy. If desired this can of coursed trivially be merged with share.js
Lets see what jenkins has to say at the moment.