Repository navigation
Share2.0 sharemanager - #19872
Share2.0 sharemanager#19872
Conversation
|
|
@rullzer seriously get a proper IDE - and this is no recommendation - but an order 😉 |
|
@DeepDiver1975 yeah I know it doesn't work. But I first wanted to agree if this was the way to go for the manager before I start to do all kinds of actual code and add unit tests etc. |
There was a problem hiding this comment.
I'm not sure about the namespace Share20 ... we will find something better
There was a problem hiding this comment.
Agreed. For not is just there since OC\Share was taken
|
So as discussed with @schiesbn and @nickvergessen there is now a share object which is passed around so we keep the general logic in 1 place. This looks a lot cleaner than it was before. It keeps a lot of logic at the right place. This means that the manager and providers now have And that is enough share manager for today. |
There was a problem hiding this comment.
since merging these results has it's drawbacks we might want to consider getShares to be specific for the share type
There was a problem hiding this comment.
yeah, the "TODO proper pagination" will teach you that merging arrays will not work together with paging, remember the sharee mess.
There was a problem hiding this comment.
@nickvergessen that was my point exactly. Doing it properly means we either have to define an order ourself. i.e. user, group, link, remote.
Since I think just limiting them to the sharetype is not really what people expect (and will also break the current OCS API behaviour)
There was a problem hiding this comment.
Since I think just limiting them to the sharetype is not really what people expect (and will also break the current OCS API behaviour)
What is the existing behavior with respect to OCS API? Can it properly perform pagination?
There was a problem hiding this comment.
What is the existing behavior with respect to OCS API? Can it properly perform pagination?
No selection on share type. No pagination just everything is returned.
There was a problem hiding this comment.
because the id (unique autoincrement from db) belongs to two different tables
the idea was to prefix these ids with a provider prefix ... but yes this design is kind of questinoable under the light of pagination
There was a problem hiding this comment.
Then the getShareById function should also require an shareType. Which means that routes like
shares/<ID> are no longer valid.
And they are now.
There was a problem hiding this comment.
shares/ are no longer valid.
What ID can that be? Fed shares as well? I don't think so - right?
There was a problem hiding this comment.
that can currently be any initiated sharing id. So if I share to you a federated share... and that on my side has id 5 I can get it via shares/5
There was a problem hiding this comment.
Updated the code with how I think we can do proper pagination on this.
6806b69 to
69514d0
Compare
|
I added the register functions back as dicussed with @schiesbn. Since we want our own implentations to be able to register themselfs so they can be used as fallback if the storage does not provide it. Also I modified the manager a bit to allow for proper pagination of shares by ordering them by shareType. |
whatfor? the default implementation is provided by the default implementation of the home storage. |
With all the effort we spend moving core functionality to apps this seems logical. |
|
@rullzer Which effort to move core functionality to apps do you mean? |
Well we move webdav to a separate app. There are efforts to get the preview generation out of core and only keep the manager etc. |
|
I'm not aware of any work to move previews out. So this is not a general theme or indication that we should do this ll over the place :-) |
we still have the "federated share provider" which will be a app and you don't want that the app manager need to know the app name, need to know what it does, need to check if the app is enabled and then call it. The other way around makes just much more sense. Also I'm not sure yet if the default share provider for user, group and link share should be implemented as part of our home storage because we also need it as fall back if a different storage is used but didn't implement a share provider. In such a case it makes much more sense if we have a "federated share provider" and a "oc default internal share provider" both implemented as app and which register them self at the share manager. The share manager can additionally ask the storage "getShareProvider()". If something is returned fine, then we use it. But it can also happen that the storage will just return false because the storage doesn't provide his own share provider, in this case we will fall back to the "oc default internal share provider" but this is only possible if this share provider is available independent from a storage implementation. |
@karlitschek with 8.2 we started to allow additional preview generators to be added by apps using public api. So it's possible to have new preview generators in apps and even move e.g. the libreoffice based preview generators to aps on their own which is encouraged by @LukasReschke if I recann correctly due to potential vulnerabilities. |
|
@schiesbn point taken regarding the fed sharing - given the all the discussions above I don't yet finally know where this all fits together ... let's see. regarding the homestorage based share provider: interface IStorage {
function getSharePoriver();
}
class Common implemets IStorage {
function getShareProvider() {
return new DefaultImplementation();
}
}
class ObjectStore extends Common {
function getShareProvider() {
return new MyVeryOwnImplementation();
}
}
class StorageWhichUsesDefault extends Common {
// simply don't implement the method
}
class ShareManager {
function getShareProvider($path) {
$this->getStorageForPath()->getShareProvider();
}
} |
class ShareManager {
function getShareProvider($path) {
$this->getStorageForPath()->getShareProvider();
}
}Just to clarify, do we then expect the storage to take care of all the magic with finding the right provider? E.g. You have a file on external storage, which does not handle its own sharing. Will it then still give us the primary storage implementation? And if the primary storage does not provide an implementation does it then automagically fetch our default implementation. I like the abstraction here, and it makes our share manager a lot simpler. But will most likely make the storage backend a little bit more complicated. |
as for now we anyhow only support the homestorage/primary storage to specify the one and only share provider. as for now we do not support additional providers on e.g. external storages - which could be an interesting thing in the future |
a00e2d6 to
5dd9bc4
Compare
|
Haha - no db likes you now! 🙊 |
629010f to
c40fbd5
Compare
|
Oracle is happy |
There was a problem hiding this comment.
I think we should trigger the hooks by the manager and not by the provider. To make sure that the hooks are always triggered, no matter which share provider is used.
There was a problem hiding this comment.
I think that is cleaner as well. But then we should also make sure that the deletion of children is actually handled from the manager. Else we would need callbacks from the providers to the manager and you have the same issue.
I agree. But lets do this in a followup PR.
There was a problem hiding this comment.
I agree. But lets do this in a followup PR.
fine with me
There was a problem hiding this comment.
Bwt we can pass objects in hooks? would it make more sense to send around the IShare?
There was a problem hiding this comment.
I think we can. But lets do that in a later stage. Because then we would not to change all listners to unshare as well.
|
beside the hooks which would move the the manager, as described here #19872 (comment) I would merge it so that we can move on. We can still adjust if needed during the next development steps 👍 |
|
One more reviewer needed... lets get this in so sharing2.0 work can continue! |
c40fbd5 to
508787f
Compare
There was a problem hiding this comment.
class name should be upper case (something for later)
|
fine by me, remaining stuff can be fixed in follow up. Especially the license needs to be done ;) 👍 |
508787f to
15f1d6b
Compare
* Added sharemanager class This is the central class where all API calls talk to (OCS/Activity). This in turn talks to the share providers to get the actual sharing done. It uses all ShareObjects * Added share class Simple class to hold all the share properties that is passed around * Added IShareProvider interface Interface that providers os a share have to implement.
OCS -> ShareManager -> DefaultShareProvider
15f1d6b to
532b8a1
Compare
|
@DeepDiver1975 Integration tests are happy :) |

@schiesbn @DeepDiver1975 first draft is here.
for now we have a sharemanager object and a ishareprovider and that is it. So no share object. Basically everything goes trough the share manager.
The manager itself acts like some kind of middleware between the shareprovider and the OCS Share API. Making sure that arguments are in the right format (date for example). And making sure that the user we want to share with exists etc.
IShareProviders register themself at the sharemanager with a callback function. And then all the magic happens.
Many things in the code do not work as expected yet or are even plain wrong now. But if we agree this is the way to go I can start cleaning up and already write some simple unit tests for this part. And do some squashing of commits :P
So feedback please :)