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

Add a single public api for resolving a cloud id to a user and remote and back #3297

Merged
merged 7 commits into from
Feb 9, 2017

Conversation

icewind1991
Copy link
Member

Instead of having at least 3 different implementations that might not all behave in the same way.

Additionally, having a single api point makes it easier to add more "fancy" ways to resolve the cloud id such as the various ways described in #782

@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Jan 27, 2017
@icewind1991 icewind1991 added this to the Nextcloud 12.0 milestone Jan 27, 2017
@mention-bot
Copy link

@icewind1991, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen, @LukasReschke and @schiessle to be potential reviewers.

@icewind1991
Copy link
Member Author

All green, @schiessle @MorrisJobke @rullzer please review

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Please add tests for the new classes

Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
@icewind1991
Copy link
Member Author

Rebased and added tests

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Only minor things mostly, but please add it to lib/private/AppFramework/DependencyInjection/DIContainer so it can be auto injected in apps

$message = 'Not allowed to create a federated share with the same user.';
$message_t = $this->l->t('Not allowed to create a federated share with the same user');
$this->logger->debug($message, ['app' => 'Federated File Sharing']);
throw new \Exception($message_t);
}

$share->setSharedWith($user . '@' . $remote);

$share->setSharedWith(rtrim($cloudId->getId(), '/'));
Copy link
Member

Choose a reason for hiding this comment

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

that should be done by getId()

public function getRemote() {
return $this->remote;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

missing new line

<?php
/**
* @copyright Copyright (c) 2017, Robin Appelman <[email protected]>
*
Copy link
Member

Choose a reason for hiding this comment

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

Missing @license GNU AGPL version 3 or any later version

<?php
/**
* @copyright Copyright (c) 2017, Robin Appelman <[email protected]>
*
Copy link
Member

Choose a reason for hiding this comment

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

Missing @license GNU AGPL version 3 or any later version

* @since 12.0.0
*/
public function getRemote();
}
Copy link
Member

Choose a reason for hiding this comment

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

new line

<?php
/**
* @copyright Copyright (c) 2017, Robin Appelman <[email protected]>
*
Copy link
Member

Choose a reason for hiding this comment

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

Missing @license GNU AGPL version 3 or any later version

<?php
/**
* @copyright Copyright (c) 2017, Robin Appelman <[email protected]>
*
Copy link
Member

Choose a reason for hiding this comment

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

Missing @license GNU AGPL version 3 or any later version

* @since 12.0.0
*/
public function isValidCloudId($cloudId);
}
Copy link
Member

Choose a reason for hiding this comment

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

new line

Signed-off-by: Robin Appelman <[email protected]>
Signed-off-by: Robin Appelman <[email protected]>
@icewind1991
Copy link
Member Author

@nickvergessen all fixed

@codecov-io
Copy link

Codecov Report

Merging #3297 into master will decrease coverage by -0.04%.

@@             Coverage Diff              @@
##             master    #3297      +/-   ##
============================================
- Coverage     54.21%   54.17%   -0.04%     
- Complexity    20987    21042      +55     
============================================
  Files          1304     1306       +2     
  Lines         80105    80336     +231     
  Branches       1253     1253              
============================================
+ Hits          43426    43526     +100     
- Misses        36679    36810     +131
Impacted Files Coverage Δ Complexity Δ
apps/federatedfilesharing/lib/Notifier.php 0% <ø> (ø) 24 <7> (ø)
...es_sharing/lib/Activity/Providers/RemoteShares.php 0% <ø> (ø) 15 <1> (+1)
...ederatedfilesharing/lib/BackgroundJob/RetryJob.php 0% <ø> (ø) 10 <ø> (ø)
ocs/v1.php 0% <ø> (ø) 0 <ø> (ø)
apps/files_sharing/lib/External/MountProvider.php 100% <100%> (ø) 4 <1> (ø)
lib/private/Share20/ProviderFactory.php 88.75% <100%> (+0.28%) 23 <ø> (ø)
lib/private/Server.php 92.62% <100%> (-0.13%) 120 <1> (+1)
...s/federatedfilesharing/lib/AppInfo/Application.php 93.93% <100%> (+0.39%) 6 <ø> (ø)
apps/federatedfilesharing/lib/AddressHandler.php 92.3% <100%> (-3.01%) 13 <ø> (-11)
lib/private/Federation/CloudIdManager.php 100% <100%> (ø) 15 <15> (?)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a591ce...0d8d658. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants