Skip to content
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

Create federated share on mount #379

Merged
merged 11 commits into from
Jul 18, 2016
Merged

Conversation

schiessle
Copy link
Member

@schiessle schiessle commented Jul 12, 2016

this way the owner sees all mounted public links and control them individually.

This changes the work flow:

  • The user now adds his federated cloud ID instead of just the server URL to the "Add to your ownCloud" input field (using the server URL is still possible to maintain backward compatibility)
  • The ownCloud will send a federated share to the user given in the input field
  • The user will be re-directed to his ownCloud and will see a notification that he received a new federated share
  • This way the owner see who mounted his public link, can adjust permissions and remove single mounts or the public link without affecting the other users
  • keep old behavior as fall-back

@schiessle schiessle added the 2. developing Work in progress label Jul 12, 2016
@schiessle schiessle added this to the Nextcloud Next milestone Jul 12, 2016
@mention-bot
Copy link

@schiessle, thanks for your PR! By analyzing the annotation information on this pull request, we identified @icewind1991, @ErikPel and @blizzz to be potential reviewers

$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')
->disableOriginalConstructor()->getMock();
$this->rootFolder = $this->getMock('OCP\Files\IRootFolder');
$this->userManager = $this->getMock('OCP\IUserManager');
Copy link
Member

Choose a reason for hiding this comment

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

cc @rullzer ;)

Copy link
Member

Choose a reason for hiding this comment

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

O yes... please use:

$this->getMockBuilder('...')->disableOriginalConstructor()->getMock()

Else there are a shitload of warnings in phpunit 5.4

@schiessle schiessle force-pushed the create_federated_share_on_mount branch 2 times, most recently from 2a77328 to 22dde3d Compare July 12, 2016 16:58
@schiessle schiessle added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 12, 2016
/**
* @author Björn Schießle <[email protected]>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

because I started it at ownCloud, the pull request also exists in the core repository... But I should at least change my email address

@schiessle schiessle added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jul 13, 2016
@schiessle schiessle force-pushed the create_federated_share_on_mount branch 2 times, most recently from aea08bc to ed56000 Compare July 13, 2016 09:34
@schiessle schiessle added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 13, 2016
@schiessle
Copy link
Member Author

Ready to review, but please do me a favour and don't look to much at legacyMountPublicLink(). It is just a 1:1 copy of apps/files_sharing/ajax/external.php to keep backward compatibility. I don't want to rewrite this code, it worked until now and it should just continue to work for the next few months/years until we can remove it. 😃

@schiessle schiessle force-pushed the create_federated_share_on_mount branch 4 times, most recently from d73e463 to 3fa8d03 Compare July 13, 2016 11:19
@schiessle schiessle force-pushed the create_federated_share_on_mount branch from 3fa8d03 to a1388cf Compare July 13, 2016 14:15
@nickvergessen
Copy link
Member

Tested file/folder share and could add it with link and cloud id,
Will look at the code now

use OCP\IUserSession;
use OCP\Share\IManager;

class SaveToNextcloudController extends Controller {
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest to avoid Nextcloud in class names?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you have a idea for a better name? "ConvertPubliLinkToFederatedShareController" maybe?

@schiessle
Copy link
Member Author

@nickvergessen I renamed the "SaveToNextcloudController" to "MountPublicLinkController"... please have a final look. Thanks!

Björn Schießle added 2 commits July 14, 2016 11:22
…loud

this way the owner sees all mounted public links and control them individually
@MorrisJobke
Copy link
Member

If the share fails to be created the loading spinner is still shown (even if you got an error message)

@MorrisJobke
Copy link
Member

I would love to see an integration test for this. We cannot risk this feature to break.

I'm currently debugging, why it is not working over here.

@MorrisJobke
Copy link
Member

MorrisJobke commented Jul 14, 2016

  • entering a wrong URL: the spinner is still there but it should be an arrow again

$httpClient = $this->clientService->newClient();

try {
$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare',
Copy link
Member

Choose a reason for hiding this comment

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

Needs some validation logic on $remote whether it's a domain or at least forbid slashes and : and @.

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise somebody could send requests to any arbitrary URL, this is something one better wants to avoid :)

Copy link
Member

Choose a reason for hiding this comment

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

forbid slashes? people that have installed their cloud in a subfolde rwill love you?

Copy link
Member Author

@schiessle schiessle Jul 14, 2016

Choose a reason for hiding this comment

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

don't understand this one. As said by @nickvergessen you need slashes if your Nextcloud is installed in a sub folder.

How do you want to decide which a address is pointing to a Nextcloud and which is not before you tried to send a federated share?

Copy link
Member

Choose a reason for hiding this comment

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

Hrm. True. What a pity. In this case 🙈 ;-)

@schiessle schiessle force-pushed the create_federated_share_on_mount branch from 3c2c4d7 to 03f2e5e Compare July 14, 2016 14:32
@schiessle schiessle force-pushed the create_federated_share_on_mount branch from 03f2e5e to c7f6461 Compare July 14, 2016 14:40
@schiessle
Copy link
Member Author

I'm currently debugging, why it is not working over here.

@MorrisJobke the spinner issue is fixed... anything else not working for you?

@schiessle schiessle force-pushed the create_federated_share_on_mount branch from fccdc6f to b972ba1 Compare July 14, 2016 18:47
@schiessle schiessle force-pushed the create_federated_share_on_mount branch from b972ba1 to f8a531c Compare July 14, 2016 18:48
@MorrisJobke
Copy link
Member

The spinner is still there:

bildschirmfoto 2016-07-15 um 11 55 34

@MorrisJobke
Copy link
Member

Beside that it looks good and works 👍

@MorrisJobke
Copy link
Member

The spinner is still there:

When I hit a second time enter in the input field the spinner is replaced by an arrow (but also if there needs to be a spinner).

@schiessle
Copy link
Member Author

are you sure that you reloaded the web page and refreshed the browser cache? This is how it look for me:

spinner

When I hit a second time enter in the input field the spinner is replaced by an arrow (but also if there needs to be a spinner).

Yes, we just toggle the spinner on click.

@LukasReschke
Copy link
Member

Went over the code with @schiessle. Code looks awesome. Let's do some more functional testing and then get this in 🚀 👍 🍻

@MorrisJobke
Copy link
Member

Tested and works now 👍

@MorrisJobke MorrisJobke merged commit 4032811 into master Jul 18, 2016
@MorrisJobke MorrisJobke deleted the create_federated_share_on_mount branch July 18, 2016 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants