Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions apps/files_sharing/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@
'OCA\\Files_Sharing\\ResponseDefinitions' => $baseDir . '/../lib/ResponseDefinitions.php',
'OCA\\Files_Sharing\\Scanner' => $baseDir . '/../lib/Scanner.php',
'OCA\\Files_Sharing\\Settings\\Personal' => $baseDir . '/../lib/Settings/Personal.php',
'OCA\\Files_Sharing\\ShareBackend\\File' => $baseDir . '/../lib/ShareBackend/File.php',
'OCA\\Files_Sharing\\ShareBackend\\Folder' => $baseDir . '/../lib/ShareBackend/Folder.php',
'OCA\\Files_Sharing\\ShareTargetValidator' => $baseDir . '/../lib/ShareTargetValidator.php',
'OCA\\Files_Sharing\\SharedMount' => $baseDir . '/../lib/SharedMount.php',
'OCA\\Files_Sharing\\SharedStorage' => $baseDir . '/../lib/SharedStorage.php',
Expand Down
2 changes: 0 additions & 2 deletions apps/files_sharing/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ class ComposerStaticInitFiles_Sharing
'OCA\\Files_Sharing\\ResponseDefinitions' => __DIR__ . '/..' . '/../lib/ResponseDefinitions.php',
'OCA\\Files_Sharing\\Scanner' => __DIR__ . '/..' . '/../lib/Scanner.php',
'OCA\\Files_Sharing\\Settings\\Personal' => __DIR__ . '/..' . '/../lib/Settings/Personal.php',
'OCA\\Files_Sharing\\ShareBackend\\File' => __DIR__ . '/..' . '/../lib/ShareBackend/File.php',
'OCA\\Files_Sharing\\ShareBackend\\Folder' => __DIR__ . '/..' . '/../lib/ShareBackend/Folder.php',
'OCA\\Files_Sharing\\ShareTargetValidator' => __DIR__ . '/..' . '/../lib/ShareTargetValidator.php',
'OCA\\Files_Sharing\\SharedMount' => __DIR__ . '/..' . '/../lib/SharedMount.php',
'OCA\\Files_Sharing\\SharedStorage' => __DIR__ . '/..' . '/../lib/SharedStorage.php',
Expand Down
6 changes: 0 additions & 6 deletions apps/files_sharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace OCA\Files_Sharing\AppInfo;

use OC\Group\DisplayNameCache as GroupDisplayNameCache;
use OC\Share\Share;
use OC\User\DisplayNameCache;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
Expand All @@ -34,8 +33,6 @@
use OCA\Files_Sharing\MountProvider;
use OCA\Files_Sharing\Notification\Listener;
use OCA\Files_Sharing\Notification\Notifier;
use OCA\Files_Sharing\ShareBackend\File;
use OCA\Files_Sharing\ShareBackend\Folder;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand Down Expand Up @@ -130,9 +127,6 @@ public function boot(IBootContext $context): void {
$context->injectFn([$this, 'registerEventsScripts']);

Helper::registerHooks();

Share::registerBackend('file', File::class);
Share::registerBackend('folder', Folder::class, 'file');
}


Expand Down
28 changes: 8 additions & 20 deletions apps/files_sharing/lib/Controller/ShareesAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ public function search(string $search = '', ?string $itemType = null, int $page
$shareTypes[] = IShare::TYPE_GROUP;
}

if ($this->isRemoteSharingAllowed($itemType)) {
if ($this->isRemoteSharingAllowed()) {
$shareTypes[] = IShare::TYPE_REMOTE;
}

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

Expand Down Expand Up @@ -309,11 +309,11 @@ public function findRecommended(string $itemType, $shareType = null): DataRespon
$shareTypes[] = IShare::TYPE_GROUP;
}

if ($this->isRemoteSharingAllowed($itemType)) {
if ($this->isRemoteSharingAllowed()) {
$shareTypes[] = IShare::TYPE_REMOTE;
}

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

Expand Down Expand Up @@ -353,24 +353,12 @@ public function findRecommended(string $itemType, $shareType = null): DataRespon
* @param string $itemType
* @return bool
*/
protected function isRemoteSharingAllowed(string $itemType): bool {
try {
// FIXME: static foo makes unit testing unnecessarily difficult
$backend = Share::getBackend($itemType);
return $backend->isShareTypeAllowed(IShare::TYPE_REMOTE);
} catch (\Exception $e) {
return false;
}
protected function isRemoteSharingAllowed(): bool {
return $this->federatedShareProvider->isOutgoingServer2serverShareEnabled();
}

protected function isRemoteGroupSharingAllowed(string $itemType): bool {
try {
// FIXME: static foo makes unit testing unnecessarily difficult
$backend = Share::getBackend($itemType);
return $backend->isShareTypeAllowed(IShare::TYPE_REMOTE_GROUP);
} catch (\Exception $e) {
return false;
}
protected function isRemoteGroupSharingAllowed(): bool {
return $this->federatedShareProvider->isOutgoingServer2serverGroupShareEnabled();
}


Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/External/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public function getOwner(string $path): string|false {
}

public function isSharable(string $path): bool {
if (Util::isSharingDisabledForUser() || !Share::isResharingAllowed()) {
if (Util::isSharingDisabledForUser() || $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') !== 'yes') {
return false;
}
return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE);
Expand Down
11 changes: 1 addition & 10 deletions apps/files_sharing/lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function registerHooks() {
* @param View $view
* @return string $path
*/
public static function generateUniqueTarget($path, $view) {
public static function generateUniqueTarget(string $path, View $view): string {
$pathinfo = pathinfo($path);
$ext = isset($pathinfo['extension']) ? '.' . $pathinfo['extension'] : '';
$name = $pathinfo['filename'];
Expand Down Expand Up @@ -82,13 +82,4 @@ public static function getShareFolder(?View $view = null, ?string $userId = null

return $shareFolder;
}

/**
* set default share folder
*
* @param string $shareFolder
*/
public static function setShareFolder($shareFolder) {
Server::get(IConfig::class)->setSystemValue('share_folder', $shareFolder);
}
}
228 changes: 0 additions & 228 deletions apps/files_sharing/lib/ShareBackend/File.php

This file was deleted.

Loading
Loading