Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add new share type federated_group and provider for VO app
Signed-off-by: Sandro Mesterheide <[email protected]>

Add support for share type federated_group in files_sharing app

Signed-off-by: Sandro Mesterheide <[email protected]>

Add share type support for federation providers

Signed-off-by: Sandro Mesterheide <[email protected]>

Add migration for share_external table

Signed-off-by: Sandro Mesterheide <[email protected]>

fix currentUser reference

php-cs-fixer

psalm feedback

Co-authored-by: Dirk Olbertz <[email protected]>
Signed-off-by: Sandro Mesterheide <[email protected]>
  • Loading branch information
smesterheide and ppdiol committed May 21, 2025
commit bfac1be2cd26aedae394431cf8b8d198a4bdf7fb
11 changes: 9 additions & 2 deletions apps/cloud_federation_api/lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ public function __construct(
*/
public function getSupportedShareTypes($resourceType) {
try {
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
return $provider->getSupportedShareTypes();
$supportedShareTypes = [];
$cloudFederationProviders = $this->cloudFederationProviderManager->getAllCloudFederationProviders();
foreach ($cloudFederationProviders as $providerWrapper) {
if ($providerWrapper['resourceType'] === $resourceType) {
$providerSupportedShareTypes = $providerWrapper['provider']->getSupportedShareTypes();
$supportedShareTypes = array_merge($supportedShareTypes, $providerSupportedShareTypes);
}
}
return array_unique($supportedShareTypes);
} catch (\Exception $e) {
$this->logger->error('Failed to create federation provider', ['exception' => $e]);
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ public function addShare($shareWith, $name, $description, $providerId, $owner, $
}
}

if ($shareType === 'federation') {
// Allow creation of pending shares by federation provider
}
Comment on lines +171 to +173
Copy link
Contributor

Choose a reason for hiding this comment

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

?


// if no explicit display name is given, we use the uid as display name
$ownerDisplayName = $ownerDisplayName === null ? $owner : $ownerDisplayName;
$sharedByDisplayName = $sharedByDisplayName === null ? $sharedBy : $sharedByDisplayName;
Expand All @@ -179,7 +183,7 @@ public function addShare($shareWith, $name, $description, $providerId, $owner, $
}

try {
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType, $shareType);
$share = $this->factory->getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, '', $shareType, $resourceType);
$share->setProtocol($protocol);
$provider->shareReceived($share);
Expand Down Expand Up @@ -258,7 +262,7 @@ public function receiveNotification($notificationType, $resourceType, $providerI
}

try {
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType, $notification['shareType']);
$result = $provider->notificationReceived($notificationType, $providerId, $notification);
} catch (ProviderDoesNotExistsException $e) {
return new JSONResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
'OCA\\Files_Sharing\\Migration\\Version22000Date20210216084241' => $baseDir . '/../lib/Migration/Version22000Date20210216084241.php',
'OCA\\Files_Sharing\\Migration\\Version24000Date20220208195521' => $baseDir . '/../lib/Migration/Version24000Date20220208195521.php',
'OCA\\Files_Sharing\\Migration\\Version24000Date20220404142216' => $baseDir . '/../lib/Migration/Version24000Date20220404142216.php',
'OCA\\Files_Sharing\\Migration\\Version26000Date20230117143027' => $baseDir . '/../lib/Migration/Version26000Date20230117143027.php',
'OCA\\Files_Sharing\\Migration\\Version31000Date20240821142813' => $baseDir . '/../lib/Migration/Version31000Date20240821142813.php',
'OCA\\Files_Sharing\\MountProvider' => $baseDir . '/../lib/MountProvider.php',
'OCA\\Files_Sharing\\Notification\\Listener' => $baseDir . '/../lib/Notification/Listener.php',
Expand Down
1 change: 1 addition & 0 deletions apps/files_sharing/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class ComposerStaticInitFiles_Sharing
'OCA\\Files_Sharing\\Migration\\Version22000Date20210216084241' => __DIR__ . '/..' . '/../lib/Migration/Version22000Date20210216084241.php',
'OCA\\Files_Sharing\\Migration\\Version24000Date20220208195521' => __DIR__ . '/..' . '/../lib/Migration/Version24000Date20220208195521.php',
'OCA\\Files_Sharing\\Migration\\Version24000Date20220404142216' => __DIR__ . '/..' . '/../lib/Migration/Version24000Date20220404142216.php',
'OCA\\Files_Sharing\\Migration\\Version26000Date20230117143027' => __DIR__ . '/..' . '/../lib/Migration/Version26000Date20230117143027.php',
'OCA\\Files_Sharing\\Migration\\Version31000Date20240821142813' => __DIR__ . '/..' . '/../lib/Migration/Version31000Date20240821142813.php',
'OCA\\Files_Sharing\\MountProvider' => __DIR__ . '/..' . '/../lib/MountProvider.php',
'OCA\\Files_Sharing\\Notification\\Listener' => __DIR__ . '/..' . '/../lib/Notification/Listener.php',
Expand Down
64 changes: 59 additions & 5 deletions apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
*
* @param IShare $share
* @param Node|null $recipientNode
* @return Files_SharingShare
* @return array
* @throws NotFoundException In case the node can't be resolved.
*
* @suppress PhanUndeclaredClassMethod
Expand Down Expand Up @@ -305,6 +305,14 @@
$result = array_merge($result, $scienceMeshShare);
} catch (ContainerExceptionInterface $e) {
}
} elseif ($share->getShareType() === IShare::TYPE_FEDERATED_GROUP) {
$group = $this->groupManager->get($share->getSharedWith());
$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 on line 313 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedDocblockClass

apps/files_sharing/lib/Controller/ShareAPIController.php:313:36: UndefinedDocblockClass: Docblock-defined class, interface or enum named OCA\VO_Federation\Sharing\ShareAPIHelper does not exist (see https://psalm.dev/200)
} catch (QueryException $e) {
}
}


Expand Down Expand Up @@ -455,7 +463,7 @@
*
* @param string $id ID of the share
* @param bool $include_tags Include tags in the share
* @return DataResponse<Http::STATUS_OK, list<Files_SharingShare>, array{}>

Check failure on line 466 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidReturnType

apps/files_sharing/lib/Controller/ShareAPIController.php:466:13: InvalidReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{'is-mount-root': bool, 'mount-type': string, attributes: null|string, can_delete: bool, can_edit: bool, displayname_file_owner: string, displayname_owner: string, expiration: null|string, file_parent: int, file_source: int, file_target: string, has_preview: bool, hide_download: 0|1, id: string, item_mtime: int, item_permissions?: int, item_size: float|int, item_source: int, item_type: 'file'|'folder', label: string, mail_send: 0|1, mimetype: string, note: string, parent: null, password?: null|string, password_expiration_time?: null|string, path: null|string, permissions: int, send_password_by_talk?: bool, share_type: int, share_with?: null|string, share_with_avatar?: string, share_with_displayname?: string, share_with_displayname_unique?: null|string, share_with_link?: string, status?: array{clearAt: int|null, icon: null|string, message: null|string, status: string}, stime: int, storage: int, storage_id: string, token: null|string, uid_file_owner: string, uid_owner: string, url?: string}>, array<never, never>>' for OCA\Files_Sharing\Controller\ShareAPIController::getShare is incorrect, got 'OCP\AppFramework\Http\DataResponse<200, list{0?: array<array-key, mixed>, ...<array{file_source: int, tags?: list<string>, ...<array-key, mixed>}>}, array<never, never>>' (see https://psalm.dev/011)
* @throws OCSNotFoundException Share not found
*
* 200: Share returned
Expand All @@ -478,7 +486,7 @@
$share = [$share];
}

return new DataResponse($share);

Check failure on line 489 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidReturnStatement

apps/files_sharing/lib/Controller/ShareAPIController.php:489:12: InvalidReturnStatement: The inferred type 'OCP\AppFramework\Http\DataResponse<200, list{0?: array<array-key, mixed>, ...<array{file_source: int, tags?: list<string>, ...<array-key, mixed>}>}, array<never, never>>' does not match the declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{'is-mount-root': bool, 'mount-type': string, attributes: null|string, can_delete: bool, can_edit: bool, displayname_file_owner: string, displayname_owner: string, expiration: null|string, file_parent: int, file_source: int, file_target: string, has_preview: bool, hide_download: 0|1, id: string, item_mtime: int, item_permissions?: int, item_size: float|int, item_source: int, item_type: 'file'|'folder', label: string, mail_send: 0|1, mimetype: string, note: string, parent: null, password?: null|string, password_expiration_time?: null|string, path: null|string, permissions: int, send_password_by_talk?: bool, share_type: int, share_with?: null|string, share_with_avatar?: string, share_with_displayname?: string, share_with_displayname_unique?: null|string, share_with_link?: string, status?: array{clearAt: int|null, icon: null|string, message: null|string, status: string}, stime: int, storage: int, storage_id: string, token: null|string, uid_file_owner: string, uid_owner: string, url?: string}>, array<never, never>>' for OCA\Files_Sharing\Controller\ShareAPIController::getShare (see https://psalm.dev/128)
}
} catch (NotFoundException $e) {
// Fall through
Expand Down Expand Up @@ -746,6 +754,15 @@
$share->setPermissions($permissions);
$share->setSharedWithDisplayName($this->getCachedFederatedDisplayName($shareWith, false));
} elseif ($shareType === IShare::TYPE_REMOTE_GROUP) {
if ($expireDate !== '') {
try {
$expireDate = $this->parseDate($expireDate);
$share->setExpirationDate($expireDate);
} catch (\Exception $e) {
throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD'));
}
}
} elseif ($shareType === IShare::TYPE_FEDERATED_GROUP) {
if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) {
throw new OCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s', [$node->getPath(), $shareType]));
}
Expand Down Expand Up @@ -1387,7 +1404,7 @@
/**
* Get all shares that are still pending
*
* @return DataResponse<Http::STATUS_OK, list<Files_SharingShare>, array{}>

Check failure on line 1407 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidReturnType

apps/files_sharing/lib/Controller/ShareAPIController.php:1407:13: InvalidReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{'is-mount-root': bool, 'mount-type': string, attributes: null|string, can_delete: bool, can_edit: bool, displayname_file_owner: string, displayname_owner: string, expiration: null|string, file_parent: int, file_source: int, file_target: string, has_preview: bool, hide_download: 0|1, id: string, item_mtime: int, item_permissions?: int, item_size: float|int, item_source: int, item_type: 'file'|'folder', label: string, mail_send: 0|1, mimetype: string, note: string, parent: null, password?: null|string, password_expiration_time?: null|string, path: null|string, permissions: int, send_password_by_talk?: bool, share_type: int, share_with?: null|string, share_with_avatar?: string, share_with_displayname?: string, share_with_displayname_unique?: null|string, share_with_link?: string, status?: array{clearAt: int|null, icon: null|string, message: null|string, status: string}, stime: int, storage: int, storage_id: string, token: null|string, uid_file_owner: string, uid_owner: string, url?: string}>, array<never, never>>' for OCA\Files_Sharing\Controller\ShareAPIController::pendingShares is incorrect, got 'OCP\AppFramework\Http\DataResponse<200, list<array{path: non-falsy-string, permissions: 0, ...<array-key, mixed>}>, array<never, never>>' (see https://psalm.dev/011)
*
* 200: Pending shares returned
*/
Expand Down Expand Up @@ -1433,7 +1450,7 @@
return $entry !== null;
}));

return new DataResponse($result);

Check failure on line 1453 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidReturnStatement

apps/files_sharing/lib/Controller/ShareAPIController.php:1453:10: InvalidReturnStatement: The inferred type 'OCP\AppFramework\Http\DataResponse<200, list<array{path: non-falsy-string, permissions: 0, ...<array-key, mixed>}>, array<never, never>>' does not match the declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{'is-mount-root': bool, 'mount-type': string, attributes: null|string, can_delete: bool, can_edit: bool, displayname_file_owner: string, displayname_owner: string, expiration: null|string, file_parent: int, file_source: int, file_target: string, has_preview: bool, hide_download: 0|1, id: string, item_mtime: int, item_permissions?: int, item_size: float|int, item_source: int, item_type: 'file'|'folder', label: string, mail_send: 0|1, mimetype: string, note: string, parent: null, password?: null|string, password_expiration_time?: null|string, path: null|string, permissions: int, send_password_by_talk?: bool, share_type: int, share_with?: null|string, share_with_avatar?: string, share_with_displayname?: string, share_with_displayname_unique?: null|string, share_with_link?: string, status?: array{clearAt: int|null, icon: null|string, message: null|string, status: string}, stime: int, storage: int, storage_id: string, token: null|string, uid_file_owner: string, uid_owner: string, url?: string}>, array<never, never>>' for OCA\Files_Sharing\Controller\ShareAPIController::pendingShares (see https://psalm.dev/128)
}

/**
Expand Down Expand Up @@ -1771,6 +1788,16 @@
if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) {
throw new ShareNotFound();
}

try {
if ($this->shareManager->shareProviderExists(IShare::TYPE_FEDERATED_GROUP)) {
$share = $this->shareManager->getShareById('ocFederatedGroupShare:' . $id, $this->userId);
return $share;
}
} catch (ShareNotFound $e) {
// Do nothing, just try the other share type
}

$share = $this->shareManager->getShareById('ocFederatedSharing:' . $id, $this->userId);

return $share;
Expand Down Expand Up @@ -1848,6 +1875,25 @@
return $this->serverContainer->get('\OCA\ScienceMesh\Sharing\ShareAPIHelper');
}

/**
* Returns the helper of ShareAPIHelper for federated group shares.
*
* If the VO federation application is not enabled or the helper is not available
* a QueryException is thrown instead.
*
* @return \OCA\VO_Federation\Sharing\ShareAPIHelper

Check failure on line 1884 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

UndefinedDocblockClass

apps/files_sharing/lib/Controller/ShareAPIController.php:1884:13: UndefinedDocblockClass: Docblock-defined class, interface or enum named OCA\VO_Federation\Sharing\ShareAPIHelper does not exist (see https://psalm.dev/200)
* @throws ContainerExceptionInterface
* @throws QueryException
* @throws \Psr\Container\NotFoundExceptionInterface
*/
private function getFederatedGroupShareHelper() {
if (!$this->appManager->isEnabledForUser('vo_federation')) {
throw new QueryException();

Check failure on line 1891 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

DeprecatedClass

apps/files_sharing/lib/Controller/ShareAPIController.php:1891:10: DeprecatedClass: OCP\AppFramework\QueryException is marked deprecated (see https://psalm.dev/098)
}

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

/**
* @param string $viewer
* @param Node $node
Expand Down Expand Up @@ -1890,6 +1936,12 @@
$federatedShares = $this->shareManager->getSharesBy(
$this->userId, IShare::TYPE_REMOTE_GROUP, $node, $reShares, -1, 0
);
if ($this->shareManager->shareProviderExists(IShare::TYPE_FEDERATED_GROUP)) {
$federatedGroupShares = $this->shareManager->getSharesBy(
$this->userId, IShare::TYPE_FEDERATED_GROUP, $node, $reShares, -1, 0
);
$federatedShares = array_merge($federatedShares, $federatedGroupShares);
}
$shares = array_merge($shares, $federatedShares);
}

Expand Down Expand Up @@ -2025,17 +2077,19 @@

// FEDERATION
if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
$federatedShares = $this->shareManager->getSharesBy($this->userId, IShare::TYPE_REMOTE, $path, $reshares, -1, 0);
$remoteShares = $this->shareManager->getSharesBy($this->userId, IShare::TYPE_REMOTE, $path, $reshares, -1, 0);
} else {
$federatedShares = [];
$remoteShares = [];
}
if ($this->shareManager->outgoingServer2ServerGroupSharesAllowed()) {
$federatedGroupShares = $this->shareManager->getSharesBy($this->userId, IShare::TYPE_REMOTE_GROUP, $path, $reshares, -1, 0);
$remoteGroupShares = $this->shareManager->getSharesBy($this->userId, IShare::TYPE_REMOTE_GROUP, $path, $reshares, -1, 0);
$federatedGroupShares = $this->shareManager->getSharesBy($this->userId, IShare::TYPE_FEDERATED_GROUP, $path, $reshares, -1, 0);
} else {
$remoteGroupShares = [];
$federatedGroupShares = [];
}

return array_merge($userShares, $groupShares, $linkShares, $mailShares, $circleShares, $roomShares, $deckShares, $sciencemeshShares, $federatedShares, $federatedGroupShares);
return array_merge($userShares, $groupShares, $linkShares, $mailShares, $circleShares, $roomShares, $deckShares, $sciencemeshShares, $remoteShares, $remoteGroupShares, $federatedGroupShares);
}


Expand Down
11 changes: 11 additions & 0 deletions apps/files_sharing/lib/Controller/ShareesAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@
protected $limit = 10;

/** @var Files_SharingShareesSearchResult */
protected $result = [

Check failure on line 49 in apps/files_sharing/lib/Controller/ShareesAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidPropertyAssignmentValue

apps/files_sharing/lib/Controller/ShareesAPIController.php:49:22: InvalidPropertyAssignmentValue: $this->result with declared type 'array{circles: list<array{label: string, shareWithDescription: string, value: array{circle: string, shareType: int, shareWith: string}}>, emails: list<array{label: string, name: string, shareWithDisplayNameUnique: string, type: string, uuid: string, value: array{shareType: int, shareWith: string}}>, exact: array{circles: list<array{label: string, shareWithDescription: string, value: array{circle: string, shareType: int, shareWith: string}}>, emails: list<array{label: string, name: string, shareWithDisplayNameUnique: string, type: string, uuid: string, value: array{shareType: int, shareWith: string}}>, groups: list<array{label: string, value: array{shareType: int, shareWith: string}}>, remote_groups: list<array{guid: string, label: string, name: string, value: array{server: string, shareType: int, shareWith: string}}>, remotes: list<array{label: string, name: string, type: string, uuid: string, value: array{server: string, shareType: int, shareWith: string}}>, rooms: list<array{label: string, value: array{shareType: int, shareWith: string}}>, users: list<array{icon: string, label: string, shareWithDisplayNameUnique: string, status: array{clearAt: int|null, icon: string, message: string, status: string}, subline: string, value: array{shareType: int, shareWith: string}}>}, groups: list<array{label: string, value: array{shareType: int, shareWith: string}}>, lookup: list<array{extra: array{address: array{value: string, verified: int}|null, email: array{value: string, verified: int}|null, federationId: string, name: array{value: string, verified: int}|null, phone: array{value: string, verified: int}|null, twitter: array{value: string, verified: int}|null, twitter_signature: array{value: string, verified: int}|null, userid: array{value: string, verified: int}|null, website: array{value: string, verified: int}|null, website_signature: array{value: string, verified: int}|null}, label: string, value: array{globalScale: bool, shareType: int, shareWith: string}}>, lookupEnabled: bool, remote_groups: list<array{guid: string, label: string, name: string, value: array{server: string, shareType: int, shareWith: string}}>, remotes: list<array{label: string, name: string, type: string, uuid: string, value: array{server: string, shareType: int, shareWith: string}}>, rooms: list<array{label: string, value: array{shareType: int, shareWith: string}}>, users: list<array{icon: string, label: string, shareWithDisplayNameUnique: string, status: array{clearAt: int|null, icon: string, message: string, status: string}, subline: string, value: array{shareType: int, shareWith: string}}>}' cannot be assigned type 'array{circles: array<never, never>, emails: array<never, never>, exact: array{circles: array<never, never>, emails: array<never, never>, federated_groups: array<never, never>, groups: array<never, never>, remote_groups: array<never, never>, remotes: array<never, never>, rooms: array<never, never>, users: array<never, never>}, federated_groups: array<never, never>, groups: array<never, never>, lookup: array<never, never>, lookupEnabled: false, remote_groups: array<never, never>, remotes: array<never, never>, rooms: array<never, never>, users: array<never, never>}' (see https://psalm.dev/145)
'exact' => [
'users' => [],
'groups' => [],
'remotes' => [],
'remote_groups' => [],
'federated_groups' => [],
'emails' => [],
'circles' => [],
'rooms' => [],
Expand All @@ -60,6 +61,7 @@
'groups' => [],
'remotes' => [],
'remote_groups' => [],
'federated_groups' => [],
'emails' => [],
'lookup' => [],
'circles' => [],
Expand Down Expand Up @@ -137,6 +139,10 @@

if ($this->isRemoteGroupSharingAllowed($itemType)) {
$shareTypes[] = IShare::TYPE_REMOTE_GROUP;

if ($this->shareManager->shareProviderExists(IShare::TYPE_FEDERATED_GROUP)) {
$shareTypes[] = IShare::TYPE_FEDERATED_GROUP;
}
}

if ($this->shareManager->shareProviderExists(IShare::TYPE_EMAIL)) {
Expand Down Expand Up @@ -239,6 +245,7 @@
IShare::TYPE_GROUP => 'groups',
IShare::TYPE_REMOTE => 'remotes',
IShare::TYPE_REMOTE_GROUP => 'remote_groups',
IShare::TYPE_FEDERATED_GROUP => 'federated_groups',
IShare::TYPE_EMAIL => 'emails',
];

Expand Down Expand Up @@ -312,6 +319,10 @@

if ($this->isRemoteGroupSharingAllowed($itemType)) {
$shareTypes[] = IShare::TYPE_REMOTE_GROUP;

if ($this->shareManager->shareProviderExists(IShare::TYPE_FEDERATED_GROUP)) {
$shareTypes[] = IShare::TYPE_FEDERATED_GROUP;
}
}

if ($this->shareManager->shareProviderExists(IShare::TYPE_EMAIL)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2023 Sandro Mesterheide <[email protected]>
*
* @author Sandro Mesterheide <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\Files_Sharing\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version26000Date20230117143027 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

$table = $schema->getTable('share_external');
$changed = false;

$column = $table->getColumn('user');
if ($column->getLength() < 255) {
$column->setLength(255);
$changed = true;
}

if (!$table->hasColumn('remote_share_type')) {
$table->addColumn('remote_share_type', Types::INTEGER, [
'notnull' => false,
'length' => 4,
]);
$changed = true;
}

if ($changed) {
return $schema;
}

return null;
}
}
2 changes: 2 additions & 0 deletions apps/files_sharing/src/components/SharingEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export default {
title += ` (${t('files_sharing', 'remote group')})`
} else if (this.share.type === ShareType.Guest) {
title += ` (${t('files_sharing', 'guest')})`
} else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_FEDERATED_GROUP) {
title += ` (${t('files_sharing', 'federated group')})`
}
if (!this.isShareOwner && this.share.ownerDisplayName) {
title += ' ' + t('files_sharing', 'by {initiator}', {
Expand Down
7 changes: 6 additions & 1 deletion apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default {

let shareType = []

const remoteTypes = [ShareType.Remote, ShareType.RemoteGroup]
const remoteTypes = [ShareType.Remote, ShareType.RemoteGroup, ShareType.FederatedGroup]

if (this.isExternal && !this.config.showFederatedSharesAsInternal) {
shareType.push(...remoteTypes)
Expand Down Expand Up @@ -443,6 +443,11 @@ export default {
icon: 'icon-sciencemesh',
iconTitle: t('files_sharing', 'ScienceMesh'),
}
case this.SHARE_TYPES.SHARE_TYPE_FEDERATED_GROUP:
return {
icon: 'icon-organization',
iconTitle: t('files_sharing', 'Virtual organization'),
}
default:
return {}
}
Expand Down
16 changes: 16 additions & 0 deletions core/img/actions/organization.svg
Copy link
Member

Choose a reason for hiding this comment

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

Should be an outlined icon as per our new icon guidelines

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions core/src/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const icons = {
'menu': path.join(__dirname, '../img', 'actions', 'menu.svg'),
'more': path.join(__dirname, '../img', 'actions', 'more.svg'),
'music': path.join(__dirname, '../img', 'places', 'music.svg'),
'organization': path.join(__dirname, '../img', 'actions', 'organization.svg'),
'password': path.join(__dirname, '../img', 'actions', 'password.svg'),
'pause': path.join(__dirname, '../img', 'actions', 'pause.svg'),
'phone': path.join(__dirname, '../img', 'clients', 'phone.svg'),
Expand Down
Loading
Loading