Skip to content

[Share 2.0] register providers - #21552

Merged
DeepDiver1975 merged 4 commits into
masterfrom
share2.0_register_providers
Jan 13, 2016
Merged

DeepDiver1975 merged 4 commits into
masterfrom
share2.0_register_providers

Conversation

@rullzer

@rullzer rullzer commented Jan 8, 2016

Copy link
Copy Markdown
Contributor

For #19331

Allow registering of providers.

Lets see what CI has to say.

@rullzer rullzer added this to the 9.0-current milestone Jan 8, 2016
@rullzer
rullzer force-pushed the share2.0_register_providers branch from 50b44f3 to 9369a25 Compare January 8, 2016 14:34
@DeepDiver1975

Copy link
Copy Markdown
Contributor

Will there ever be the need to have multiple providers of the same type?

If not we can move this to pure config as we did this with the commants manager
https://github.com/owncloud/core/blob/master/lib/private/comments/managerfactory.php
https://github.com/owncloud/core/blob/master/config/config.sample.php#L812

Would result in less code - and less to test ....

@rullzer

rullzer commented Jan 8, 2016

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 no I don't think so. Because if there are multiple providers for the same type how will we know which once to use.

We will need multiple providers. And multiple types per provider.

Moving to config is also fine with me...

@schiesbn opinion?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

I don't think we need mutliple providers for the same share type.

From my POV this is beyond the current concept to have 10 implementations of public link sharing running at the same time.

@rullzer

rullzer commented Jan 8, 2016

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 yeah I'm agreeing with you :P

@schiessle

Copy link
Copy Markdown
Contributor

I don't think we need to support multiple providers for the same share type. I would only allow to register one provider for one share type. Even if, at some point in time, we have two share provider which do some kind of link sharing they should have two different share types. For example "linkShare" and "SuperLinkShareNG". The share type should the unique identifier which connects a share to a share provider.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

so - reading the classname from the config is much easier from my pov

@rullzer

rullzer commented Jan 8, 2016

Copy link
Copy Markdown
Contributor Author

Ok let me look into that then :)

@rullzer

rullzer commented Jan 9, 2016

Copy link
Copy Markdown
Contributor Author

Ok so after looking into it. I think it having this into config.php makes sense. Since it requires explicit action from the admin to setup the different share providers. Which I think is a good thing here.

But since we will have 2 share providers at least (default and federated) I'm thinking how to represent this. And how not to complecate the setup to much. Because we need to know for which share types.

So in short the code needs to stay I think. But it reduces stuff in the public name space.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

But since we will have 2 share providers at least (default and federated) I'm thinking how to represent this. And how not to complecate the setup to much. Because we need to know for which share types.

I'd leave this to the factory - the factory is the class which is defined in the config.

The factory method will return the provider for the asked share type.

@rullzer

rullzer commented Jan 10, 2016

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 you mean that we list in general 2 provider factories there.
Then we call those factories and they return the class and an array of share types which wee will then register at the manager?

I can see that working :)

@DeepDiver1975

Copy link
Copy Markdown
Contributor

One factory to rule them all.

@rullzer

rullzer commented Jan 10, 2016

Copy link
Copy Markdown
Contributor Author

One factory to rule them all.

But if people want to deploy their own sharae provider it is likely they only want to do the 'main' share provider. But keep the federated sharing for example. Would they then need to create their own factory to create their own provider and the federated provider?

@rullzer
rullzer force-pushed the share2.0_register_providers branch 2 times, most recently from fc038d0 to b6dc216 Compare January 11, 2016 11:56
@rullzer

rullzer commented Jan 11, 2016

Copy link
Copy Markdown
Contributor Author

Now using the factory apporoach. Everything still works as expected.

@rullzer rullzer changed the title [WIP] [Share 2.0] register providers [Share 2.0] register providers Jan 12, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be public?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, eventually. But I want to move that over once I also move the other interfaces to OCP

@rullzer
rullzer force-pushed the share2.0_register_providers branch from 5384b26 to 761c060 Compare January 12, 2016 12:52
@rullzer

rullzer commented Jan 12, 2016

Copy link
Copy Markdown
Contributor Author

Ok now we call the factory only in the manager. There might be more room for optimization there. But I'd like to move forward with this PR.

CC: @DeepDiver1975 @nickvergessen

@rullzer
rullzer force-pushed the share2.0_register_providers branch from 332b62a to 10f1adb Compare January 13, 2016 09:06
Comment thread lib/private/share20/manager.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$share === null
and then drop the found

@rullzer
rullzer force-pushed the share2.0_register_providers branch from 10f1adb to 4681ca9 Compare January 13, 2016 09:19
Comment thread lib/private/share20/manager.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd simply forward this call to the factory - no need to build the array.

We need a provider -> ask the factory to build one and we use it.

@rullzer
rullzer force-pushed the share2.0_register_providers branch 5 times, most recently from 94fe470 to 69165a5 Compare January 13, 2016 14:36
@rullzer

rullzer commented Jan 13, 2016

Copy link
Copy Markdown
Contributor Author

Warg... this PR got bigger than intented again :(

Now:

  • providers are all handled in the factory including fetching logic
  • A share now has a fullId (which is 'providerId:shareId'). That way shares are unique. This is required for multiple share providers.
    • However the OCS endpoint v1 can't use them yet since there id's are ints. So we have to hack around it.

One more look please: @DeepDiver1975 @nickvergessen @schiesbn @LukasReschke

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix this in a future PR... doing it here will make it to big.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind to create an issue for this? - We all know what happens to FIXMEs in the code 😉

@DeepDiver1975

Copy link
Copy Markdown
Contributor

move it in 👍

any chance in squashing some of these commits?

* Properly register the default share provider
* Add providers
* Add share manager to server container
* Use share manager from server container
* Properly get the share manager
Now that we support multiple managers we communicate shares to the
outside as 'providerId:shareId'. This makes sures that id's are unique
when references from the OCS API.

However, since we do not want to break the OCS API v1 we need to
somewhat hack around this.

When we switch to OCS API v2 (which we should when we support more
custom providers). We will change the id to always be the fullShareId.
* Updated unit tests (bit cleaner now)
@rullzer
rullzer force-pushed the share2.0_register_providers branch 2 times, most recently from c3e8dd7 to 5f5951c Compare January 13, 2016 15:37
@rullzer

rullzer commented Jan 13, 2016

Copy link
Copy Markdown
Contributor Author

any chance in squashing some of these commits?

Done!

@LukasReschke

Copy link
Copy Markdown
Contributor

🙏 👍

@DeepDiver1975

Copy link
Copy Markdown
Contributor

nice

DeepDiver1975 added a commit that referenced this pull request Jan 13, 2016
@DeepDiver1975
DeepDiver1975 merged commit 8b346ab into master Jan 13, 2016
@DeepDiver1975
DeepDiver1975 deleted the share2.0_register_providers branch January 13, 2016 16:36
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants