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 new share type for federated groups #34132

Closed

Conversation

smesterheide
Copy link

@smesterheide smesterheide commented Sep 19, 2022

Summary

The PR aims to add a new share type for remote groups on multiple federated NC instances.

Changes

  • New NC shareType federated_group and corresponding OCM shareType federation
  • CloudFederationProvider are registered for a resourceType and shareType instead of a resourceType (file) alone.
  • Migration for share_external table
    • The user column length is increased from 64 to 255 characters to allow long group names

TODO

  • ...

Checklist

@szaimen szaimen added the 3. to review Waiting for reviews label Sep 19, 2022
@szaimen szaimen added this to the Nextcloud 26 milestone Sep 19, 2022
lib/private/Share20/ProviderFactory.php Fixed Show fixed Hide fixed
lib/private/Share20/ProviderFactory.php Fixed Show fixed Hide fixed
lib/private/Share20/ProviderFactory.php Fixed Show fixed Hide fixed
lib/private/Share20/ProviderFactory.php Fixed Show fixed Hide fixed
lib/private/Share20/ProviderFactory.php Fixed Show fixed Hide fixed
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Psalm found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@smesterheide smesterheide changed the title Introducing VIRT_ORG share type Add new share type for federated groups Oct 5, 2022
@smesterheide smesterheide marked this pull request as draft October 5, 2022 04:57
@smesterheide smesterheide requested a review from come-nc October 5, 2022 04:57
@smesterheide smesterheide force-pushed the vo-federation-features branch from 4ce8730 to 0e094a6 Compare October 5, 2022 10:38
@come-nc
Copy link
Contributor

come-nc commented Oct 10, 2022

/compile-amend /

@come-nc
Copy link
Contributor

come-nc commented Oct 10, 2022

Related branch on application side: https://github.com/nextcloud/vo_federation/tree/wip/share-provider

@come-nc
Copy link
Contributor

come-nc commented Oct 10, 2022

Question:
The application needs the same Database queries as in FederatedShareProvider, how to avoid duplication?
Should we have some kind of Entity+QBMapper implementation for share table?

@@ -69,6 +70,8 @@
private $circlesAreNotAvailable = false;
/** @var \OCA\Talk\Share\RoomShareProvider */
private $roomShareProvider = null;
/** @var \OCA\VO_Federation\FederatedGroupShareProvider */

Check failure

Code scanning / Psalm

UndefinedDocblockClass

Docblock-defined class, interface or enum named OCA\VO_Federation\FederatedGroupShareProvider does not exist
/**
* Create the federated group share provider
*
* @return FederatedGroupShareProvider

Check failure

Code scanning / Psalm

UndefinedDocblockClass

Docblock-defined class, interface or enum named OC\Share20\FederatedGroupShareProvider does not exist
try {
$this->federatedGroupShareProvider = $this->serverContainer->query('\OCA\VO_Federation\FederatedGroupShareProvider');
} catch (\OCP\AppFramework\QueryException $e) {
return null;

Check failure

Code scanning / Psalm

NullableReturnStatement

The declared return type 'OC\Share20\FederatedGroupShareProvider' for OC\Share20\ProviderFactory::getFederatedGroupShareProvider is not nullable, but the function returns 'null'
}
}

return $this->federatedGroupShareProvider;

Check failure

Code scanning / Psalm

InvalidReturnStatement

The inferred type 'OCA\VO_Federation\FederatedGroupShareProvider|mixed' does not match the declared return type 'OC\Share20\FederatedGroupShareProvider' for OC\Share20\ProviderFactory::getFederatedGroupShareProvider
@schiessle
Copy link
Member

I can't say something about the code as such, this is something @come-nc and others have to decide.

But the general structure and the introduction of the share type "IShare::TYPE_FEDERATED_GROUP" looks fine to me

@@ -69,6 +70,8 @@ class ProviderFactory implements IProviderFactory {
private $circlesAreNotAvailable = false;
/** @var \OCA\Talk\Share\RoomShareProvider */
private $roomShareProvider = null;
/** @var \OCA\VO_Federation\FederatedGroupShareProvider */
Copy link
Author

Choose a reason for hiding this comment

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

Usually we would use the registerProvider function here to dynamically register our provider from our Application.php

As it turns out the ProviderFactory is also required by remote.php during WebDAV share mounts where normal app bootstrapping is skipped.

@smesterheide smesterheide force-pushed the vo-federation-features branch from e55f2e6 to 373ad1d Compare November 23, 2022 01:40
*
* @param ICloudFederationShare $share
* @return ICloudFederationProvider
* @throws ProviderDoesNotExistsException

Check failure

Code scanning / Psalm

UndefinedDocblockClass

Docblock-defined class, interface or enum named OCP\Federation\ProviderDoesNotExistsException does not exist
@come-nc
Copy link
Contributor

come-nc commented Nov 24, 2022

Can you please run composer run cs:fix to fix code style, and look into errors returned by https://github.com/nextcloud/server/actions/runs/3528525824/jobs/5918722980

$result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $group !== null ? $group->getDisplayName() : $share->getSharedWith();
try {
$result = array_merge($result, $this->getFederatedGroupShareHelper()->formatShare($share));

Check failure

Code scanning / Psalm

UndefinedDocblockClass

Docblock-defined class, interface or enum named OCA\VO_Federation\Sharing\ShareAPIHelper does not exist
*/
private function getFederatedGroupShareHelper() {
if (!$this->appManager->isEnabledForUser('vo_federation')) {
throw new QueryException();

Check failure

Code scanning / Psalm

UndefinedDocblockClass

Docblock-defined class, interface or enum named OCA\VO_Federation\Sharing\ShareAPIHelper does not exist

return $this->serverContainer->get('\OCA\VO_Federation\Sharing\ShareAPIHelper');
}

Check notice

Code scanning / Psalm

DeprecatedClass

OCP\AppFramework\QueryException is marked deprecated
@smesterheide smesterheide force-pushed the vo-federation-features branch from 016ff53 to 0c5c6a1 Compare January 17, 2023 12:47
@blizzz blizzz mentioned this pull request Feb 1, 2023
@skjnldsv skjnldsv mentioned this pull request May 9, 2023
@blizzz blizzz mentioned this pull request May 17, 2023
@blizzz blizzz modified the milestones: Nextcloud 27, Nextcloud 28 May 23, 2023
@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
This was referenced Mar 12, 2024
This was referenced Mar 20, 2024
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@skjnldsv skjnldsv modified the milestones: Nextcloud 29, Nextcloud 30 Mar 28, 2024
@skjnldsv skjnldsv added 2. developing Work in progress stale Ticket or PR with no recent activity and removed 3. to review Waiting for reviews labels Jul 27, 2024
This was referenced Jul 30, 2024
This was referenced Aug 5, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv closed this Aug 14, 2024
@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
@skjnldsv
Copy link
Member

Hi @smesterheide
It seems the request for this feature is quite low unfortunately.
I might be missing some context, but seeing the lack of feedback or attention, this desn't seem to be on our roadmap i the near future.

If you want to spark a conversation again, because it actually fit another feature, feel free to do so, we'll be happy to talk and assist you! :)
Have a great day!
Cheers, John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress stale Ticket or PR with no recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants