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

feat(federation): auto-accept shares from trusted servers #49973

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Dec 26, 2024

Needs #49974
Fix #34550

image

@skjnldsv

This comment was marked as resolved.

@skjnldsv skjnldsv self-assigned this Dec 26, 2024
@skjnldsv skjnldsv added this to the Nextcloud 31 milestone Dec 26, 2024
@skjnldsv skjnldsv force-pushed the feat/auto-accept-trusted-server branch 2 times, most recently from ff6f6e6 to 5d4c7b7 Compare December 26, 2024 16:08
@skjnldsv skjnldsv changed the base branch from master to backport/49973/master December 26, 2024 16:08
@skjnldsv skjnldsv force-pushed the feat/auto-accept-trusted-server branch 2 times, most recently from e29a165 to c78d1fe Compare December 26, 2024 17:47
@skjnldsv skjnldsv force-pushed the backport/49973/master branch from 1d4cadb to a710e0c Compare December 27, 2024 09:08
@skjnldsv skjnldsv force-pushed the feat/auto-accept-trusted-server branch 9 times, most recently from 0ba688c to 9e36462 Compare December 28, 2024 07:48
@skjnldsv skjnldsv marked this pull request as ready for review December 28, 2024 07:48
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 28, 2024
@skjnldsv skjnldsv requested a review from a team December 28, 2024 07:49
@skjnldsv skjnldsv requested review from ArtificialOwl, nfebe, susnux and come-nc and removed request for a team December 28, 2024 07:49
@skjnldsv skjnldsv force-pushed the feat/auto-accept-trusted-server branch from 9e36462 to 19e8cbe Compare December 28, 2024 07:50
@skjnldsv skjnldsv force-pushed the backport/49973/master branch from a710e0c to bc0ad5e Compare December 28, 2024 08:27
@skjnldsv skjnldsv force-pushed the feat/auto-accept-trusted-server branch from 19e8cbe to 094727a Compare December 28, 2024 08:28
Base automatically changed from backport/49973/master to master January 2, 2025 10:50
@skjnldsv skjnldsv force-pushed the feat/auto-accept-trusted-server branch from 8b3c276 to 2467a25 Compare January 2, 2025 12:13
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

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

A bit of nitpick, apart from that backend code looks good.

@@ -999,6 +999,11 @@ public function isLookupServerUploadEnabled() {
return ($result === 'yes');
}

public function isFederatedTrustedShareAutoAccept() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public function isFederatedTrustedShareAutoAccept() {
public function isFederatedTrustedShareAutoAccept(): bool {

if ($this->trustedServers->isTrustedServer($url) === true) {
$message = 'Server is already in the list of trusted servers.';
$hint = $this->l->t('Server is already in the list of trusted servers.');
throw new HintException($message, $hint);
return new JSONResponse([
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use an OCSException from OCP\AppFramework\OCS and then you can keep the old behavior with the throws.
For STATUS_NOT_FOUND there is even OCSNotFoundException.

Copy link
Member Author

Choose a reason for hiding this comment

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

Completely forgot about those 🤦

Comment on lines +61 to +63
/** @var \PHPUnit\Framework\MockObject\MockObject|IConfig */
private $config;

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/** @var \PHPUnit\Framework\MockObject\MockObject|IConfig */
private $config;
private MockObject&IConfig $config;

@@ -83,7 +88,8 @@ protected function setUp(): void {
$this->trustedServers,
$this->logger,
$this->discoverService,
$this->timeFactory
$this->timeFactory,
$this->config
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$this->config
$this->config,

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

Successfully merging this pull request may close these issues.

Auto accept federated shares from trusted servers
2 participants