Merge pull request #21785 from nextcloud/techdebt/noid/remove-classmap-in-files_external
Move OC_Mount_Config to proper classname and remove OC::$CLASSPATH us…
This commit is contained in:
commit
cbbbbee8b1
|
@ -30,15 +30,13 @@
|
||||||
|
|
||||||
use OCA\Files_External\Config\ConfigAdapter;
|
use OCA\Files_External\Config\ConfigAdapter;
|
||||||
|
|
||||||
OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../3rdparty/autoload.php';
|
require_once __DIR__ . '/../3rdparty/autoload.php';
|
||||||
|
|
||||||
// register Application object singleton
|
// register Application object singleton
|
||||||
\OC_Mount_Config::$app = \OC::$server->query(\OCA\Files_External\AppInfo\Application::class);
|
\OCA\Files_External\MountConfig::$app = \OC::$server->query(\OCA\Files_External\AppInfo\Application::class);
|
||||||
\OC_Mount_Config::$app->registerListeners();
|
\OCA\Files_External\MountConfig::$app->registerListeners();
|
||||||
|
|
||||||
$appContainer = \OC_Mount_Config::$app->getContainer();
|
$appContainer = \OCA\Files_External\MountConfig::$app->getContainer();
|
||||||
|
|
||||||
\OCA\Files\App::getNavigationManager()->add(function () {
|
\OCA\Files\App::getNavigationManager()->add(function () {
|
||||||
$l = \OC::$server->getL10N('files_external');
|
$l = \OC::$server->getL10N('files_external');
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
/**
|
/**
|
||||||
* @var $this \OCP\Route\IRouter
|
* @var $this \OCP\Route\IRouter
|
||||||
**/
|
**/
|
||||||
\OC_Mount_Config::$app->registerRoutes(
|
\OCA\Files_External\MountConfig::$app->registerRoutes(
|
||||||
$this,
|
$this,
|
||||||
[
|
[
|
||||||
'resources' => [
|
'resources' => [
|
||||||
|
|
|
@ -171,7 +171,7 @@ var StorageConfig = function(id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.backendOptions = {};
|
this.backendOptions = {};
|
||||||
};
|
};
|
||||||
// Keep this in sync with \OC_Mount_Config::STATUS_*
|
// Keep this in sync with \OCA\Files_External\MountConfig::STATUS_*
|
||||||
StorageConfig.Status = {
|
StorageConfig.Status = {
|
||||||
IN_PROGRESS: -1,
|
IN_PROGRESS: -1,
|
||||||
SUCCESS: 0,
|
SUCCESS: 0,
|
||||||
|
|
|
@ -118,7 +118,7 @@ class Verify extends Base {
|
||||||
$backend = $storage->getBackend();
|
$backend = $storage->getBackend();
|
||||||
// update status (can be time-consuming)
|
// update status (can be time-consuming)
|
||||||
$storage->setStatus(
|
$storage->setStatus(
|
||||||
\OC_Mount_Config::getBackendStatus(
|
\OCA\Files_External\MountConfig::getBackendStatus(
|
||||||
$backend->getStorageClass(),
|
$backend->getStorageClass(),
|
||||||
$storage->getBackendOptions(),
|
$storage->getBackendOptions(),
|
||||||
false
|
false
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ConfigAdapter implements IMountProvider {
|
||||||
*/
|
*/
|
||||||
private function prepareStorageConfig(StorageConfig &$storage, IUser $user) {
|
private function prepareStorageConfig(StorageConfig &$storage, IUser $user) {
|
||||||
foreach ($storage->getBackendOptions() as $option => $value) {
|
foreach ($storage->getBackendOptions() as $option => $value) {
|
||||||
$storage->setBackendOption($option, \OC_Mount_Config::substitutePlaceholdersInConfig($value, $user->getUID()));
|
$storage->setBackendOption($option, \OCA\Files_External\MountConfig::substitutePlaceholdersInConfig($value, $user->getUID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$objectStore = $storage->getBackendOption('objectstore');
|
$objectStore = $storage->getBackendOption('objectstore');
|
||||||
|
|
|
@ -99,7 +99,7 @@ class ApiController extends OCSController {
|
||||||
$entries = [];
|
$entries = [];
|
||||||
$user = $this->userSession->getUser()->getUID();
|
$user = $this->userSession->getUser()->getUID();
|
||||||
|
|
||||||
$mounts = \OC_Mount_Config::getAbsoluteMountPoints($user);
|
$mounts = \OCA\Files_External\MountConfig::getAbsoluteMountPoints($user);
|
||||||
foreach ($mounts as $mountPoint => $mount) {
|
foreach ($mounts as $mountPoint => $mount) {
|
||||||
$entries[] = $this->formatMount($mountPoint, $mount);
|
$entries[] = $this->formatMount($mountPoint, $mount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ abstract class StoragesController extends Controller {
|
||||||
$backend = $storage->getBackend();
|
$backend = $storage->getBackend();
|
||||||
// update status (can be time-consuming)
|
// update status (can be time-consuming)
|
||||||
$storage->setStatus(
|
$storage->setStatus(
|
||||||
\OC_Mount_Config::getBackendStatus(
|
\OCA\Files_External\MountConfig::getBackendStatus(
|
||||||
$backend->getStorageClass(),
|
$backend->getStorageClass(),
|
||||||
$storage->getBackendOptions(),
|
$storage->getBackendOptions(),
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -29,7 +29,7 @@ use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill;
|
||||||
use OCA\Files_External\Lib\MissingDependency;
|
use OCA\Files_External\Lib\MissingDependency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Legacy compatibility for OC_Mount_Config::registerBackend()
|
* Legacy compatibility for OCA\Files_External\MountConfig::registerBackend()
|
||||||
*/
|
*/
|
||||||
class LegacyBackend extends Backend {
|
class LegacyBackend extends Backend {
|
||||||
use LegacyDependencyCheckPolyfill {
|
use LegacyDependencyCheckPolyfill {
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace OCA\Files_External;
|
||||||
|
|
||||||
use OCA\Files_External\AppInfo\Application;
|
use OCA\Files_External\AppInfo\Application;
|
||||||
use OCA\Files_External\Config\IConfigHandler;
|
use OCA\Files_External\Config\IConfigHandler;
|
||||||
use OCA\Files_External\Config\UserContext;
|
use OCA\Files_External\Config\UserContext;
|
||||||
|
@ -57,7 +59,7 @@ use phpseclib\Crypt\AES;
|
||||||
/**
|
/**
|
||||||
* Class to configure mount.json globally and for users
|
* Class to configure mount.json globally and for users
|
||||||
*/
|
*/
|
||||||
class OC_Mount_Config {
|
class MountConfig {
|
||||||
// TODO: make this class non-static and give it a proper namespace
|
// TODO: make this class non-static and give it a proper namespace
|
||||||
|
|
||||||
public const MOUNT_TYPE_GLOBAL = 'global';
|
public const MOUNT_TYPE_GLOBAL = 'global';
|
||||||
|
@ -325,7 +327,7 @@ class OC_Mount_Config {
|
||||||
$backends = implode(', ', array_map(function ($backend) {
|
$backends = implode(', ', array_map(function ($backend) {
|
||||||
return '"' . $backend->getText() . '"';
|
return '"' . $backend->getText() . '"';
|
||||||
}, $dependants));
|
}, $dependants));
|
||||||
$message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>';
|
$message .= '<p>' . MountConfig::getSingleDependencyMessage($l, $module, $backends) . '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message;
|
return $message;
|
|
@ -51,7 +51,7 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
$signal,
|
$signal,
|
||||||
$storage->getMountPoint(),
|
$storage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
['all']
|
['all']
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
@ -60,13 +60,13 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
$signal,
|
$signal,
|
||||||
$storage->getMountPoint(),
|
$storage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
$applicableUsers
|
$applicableUsers
|
||||||
);
|
);
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
$signal,
|
$signal,
|
||||||
$storage->getMountPoint(),
|
$storage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
$applicableGroups
|
$applicableGroups
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
$oldStorage->getMountPoint(),
|
$oldStorage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
['all']
|
['all']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
$oldStorage->getMountPoint(),
|
$oldStorage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
$userDeletions
|
$userDeletions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
$oldStorage->getMountPoint(),
|
$oldStorage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
$groupDeletions
|
$groupDeletions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
$newStorage->getMountPoint(),
|
$newStorage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
$userAdditions
|
$userAdditions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
$newStorage->getMountPoint(),
|
$newStorage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
$groupAdditions
|
$groupAdditions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class GlobalStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
$newStorage->getMountPoint(),
|
$newStorage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
['all']
|
['all']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,13 +83,13 @@ abstract class LegacyStoragesService {
|
||||||
$storageOptions['priority'] = $backend->getPriority();
|
$storageOptions['priority'] = $backend->getPriority();
|
||||||
}
|
}
|
||||||
$storageConfig->setPriority($storageOptions['priority']);
|
$storageConfig->setPriority($storageOptions['priority']);
|
||||||
if ($mountType === \OC_Mount_Config::MOUNT_TYPE_USER) {
|
if ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_USER) {
|
||||||
$applicableUsers = $storageConfig->getApplicableUsers();
|
$applicableUsers = $storageConfig->getApplicableUsers();
|
||||||
if ($applicable !== 'all') {
|
if ($applicable !== 'all') {
|
||||||
$applicableUsers[] = $applicable;
|
$applicableUsers[] = $applicable;
|
||||||
$storageConfig->setApplicableUsers($applicableUsers);
|
$storageConfig->setApplicableUsers($applicableUsers);
|
||||||
}
|
}
|
||||||
} elseif ($mountType === \OC_Mount_Config::MOUNT_TYPE_GROUP) {
|
} elseif ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP) {
|
||||||
$applicableGroups = $storageConfig->getApplicableGroups();
|
$applicableGroups = $storageConfig->getApplicableGroups();
|
||||||
$applicableGroups[] = $applicable;
|
$applicableGroups[] = $applicable;
|
||||||
$storageConfig->setApplicableGroups($applicableGroups);
|
$storageConfig->setApplicableGroups($applicableGroups);
|
||||||
|
@ -150,7 +150,7 @@ abstract class LegacyStoragesService {
|
||||||
$relativeMountPath = rtrim($parts[2], '/');
|
$relativeMountPath = rtrim($parts[2], '/');
|
||||||
// note: we cannot do this after the loop because the decrypted config
|
// note: we cannot do this after the loop because the decrypted config
|
||||||
// options might be needed for the config hash
|
// options might be needed for the config hash
|
||||||
$storageOptions['options'] = \OC_Mount_Config::decryptPasswords($storageOptions['options']);
|
$storageOptions['options'] = \OCA\Files_External\MountConfig::decryptPasswords($storageOptions['options']);
|
||||||
if (!isset($storageOptions['backend'])) {
|
if (!isset($storageOptions['backend'])) {
|
||||||
$storageOptions['backend'] = $storageOptions['class']; // legacy compat
|
$storageOptions['backend'] = $storageOptions['class']; // legacy compat
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ abstract class LegacyStoragesService {
|
||||||
// but at this point we don't know the max-id, so use
|
// but at this point we don't know the max-id, so use
|
||||||
// first group it by config hash
|
// first group it by config hash
|
||||||
$storageOptions['mountpoint'] = $rootMountPath;
|
$storageOptions['mountpoint'] = $rootMountPath;
|
||||||
$configId = \OC_Mount_Config::makeConfigHash($storageOptions);
|
$configId = \OCA\Files_External\MountConfig::makeConfigHash($storageOptions);
|
||||||
if (isset($storagesWithConfigHash[$configId])) {
|
if (isset($storagesWithConfigHash[$configId])) {
|
||||||
$currentStorage = $storagesWithConfigHash[$configId];
|
$currentStorage = $storagesWithConfigHash[$configId];
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,6 @@ class UserLegacyStoragesService extends LegacyStoragesService {
|
||||||
protected function readLegacyConfig() {
|
protected function readLegacyConfig() {
|
||||||
// read user config
|
// read user config
|
||||||
$user = $this->userSession->getUser()->getUID();
|
$user = $this->userSession->getUser()->getUID();
|
||||||
return \OC_Mount_Config::readData($user);
|
return \OCA\Files_External\MountConfig::readData($user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class UserStoragesService extends StoragesService {
|
||||||
$this->triggerApplicableHooks(
|
$this->triggerApplicableHooks(
|
||||||
$signal,
|
$signal,
|
||||||
$storage->getMountPoint(),
|
$storage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
[$user]
|
[$user]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Admin implements ISettings {
|
||||||
'storages' => $this->globalStoragesService->getStorages(),
|
'storages' => $this->globalStoragesService->getStorages(),
|
||||||
'backends' => $this->backendService->getAvailableBackends(),
|
'backends' => $this->backendService->getAvailableBackends(),
|
||||||
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
||||||
'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()),
|
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||||
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
||||||
'globalCredentials' => $this->globalAuth->getAuth(''),
|
'globalCredentials' => $this->globalAuth->getAuth(''),
|
||||||
'globalCredentialsUid' => '',
|
'globalCredentialsUid' => '',
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Personal implements ISettings {
|
||||||
'storages' => $this->userGlobalStoragesService->getStorages(),
|
'storages' => $this->userGlobalStoragesService->getStorages(),
|
||||||
'backends' => $this->backendService->getAvailableBackends(),
|
'backends' => $this->backendService->getAvailableBackends(),
|
||||||
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
||||||
'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()),
|
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||||
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
||||||
'globalCredentials' => $this->globalAuth->getAuth($uid),
|
'globalCredentials' => $this->globalAuth->getAuth($uid),
|
||||||
'globalCredentialsUid' => $uid,
|
'globalCredentialsUid' => $uid,
|
||||||
|
|
|
@ -50,11 +50,11 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
||||||
protected $service;
|
protected $service;
|
||||||
|
|
||||||
protected function setUp(): void {
|
protected function setUp(): void {
|
||||||
\OC_Mount_Config::$skipTest = true;
|
\OCA\Files_External\MountConfig::$skipTest = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown(): void {
|
protected function tearDown(): void {
|
||||||
\OC_Mount_Config::$skipTest = false;
|
\OCA\Files_External\MountConfig::$skipTest = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -202,7 +202,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'all'
|
'all'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -215,7 +215,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -228,7 +228,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1',
|
'group1',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -240,12 +240,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -258,12 +258,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1'
|
'group1'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2'
|
'group2'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -276,22 +276,22 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1'
|
'group1'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2'
|
'group2'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -334,27 +334,27 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
// delete the "all entry"
|
// delete the "all entry"
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'all',
|
'all',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1'
|
'group1'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2'
|
'group2'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -369,12 +369,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2'
|
'group2'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -389,12 +389,12 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2'
|
'group2'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -409,18 +409,18 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1'
|
'group1'
|
||||||
],
|
],
|
||||||
// create the "all" entry
|
// create the "all" entry
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'all'
|
'all'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -472,7 +472,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testHooksRenameMountPoint() {
|
public function testHooksRenameMountPoint() {
|
||||||
$storage = $this->makeTestStorageData();
|
$storage = $this->makeTestStorageData();
|
||||||
$storage->setApplicableUsers(['user1', 'user2']);
|
$storage->setApplicableUsers(['user1', 'user2']);
|
||||||
|
@ -491,50 +491,50 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
'/mountpoint',
|
'/mountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
'/mountpoint',
|
'/mountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
'/mountpoint',
|
'/mountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1',
|
'group1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
'/mountpoint',
|
'/mountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2',
|
'group2',
|
||||||
],
|
],
|
||||||
// creates new one
|
// creates new one
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
'/renamedMountpoint',
|
'/renamedMountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
'/renamedMountpoint',
|
'/renamedMountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
'/renamedMountpoint',
|
'/renamedMountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1',
|
'group1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
'/renamedMountpoint',
|
'/renamedMountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2',
|
'group2',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -561,22 +561,22 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user1',
|
'user1',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'user2',
|
'user2',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group1'
|
'group1'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_GROUP,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
|
||||||
'group2'
|
'group2'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -588,7 +588,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
'all',
|
'all',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
@ -102,7 +102,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
|
||||||
'datadirectory',
|
'datadirectory',
|
||||||
\OC::$SERVERROOT . '/data/'
|
\OC::$SERVERROOT . '/data/'
|
||||||
);
|
);
|
||||||
\OC_Mount_Config::$skipTest = true;
|
\OCA\Files_External\MountConfig::$skipTest = true;
|
||||||
|
|
||||||
$this->mountCache = $this->createMock(IUserMountCache::class);
|
$this->mountCache = $this->createMock(IUserMountCache::class);
|
||||||
|
|
||||||
|
@ -169,15 +169,15 @@ abstract class StoragesServiceTest extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
\OC_Mount_Config::$app = $this->getMockBuilder('\OCA\Files_External\Appinfo\Application')
|
\OCA\Files_External\MountConfig::$app = $this->getMockBuilder('\OCA\Files_External\Appinfo\Application')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
\OC_Mount_Config::$app->method('getContainer')
|
\OCA\Files_External\MountConfig::$app->method('getContainer')
|
||||||
->willReturn($containerMock);
|
->willReturn($containerMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown(): void {
|
protected function tearDown(): void {
|
||||||
\OC_Mount_Config::$skipTest = false;
|
\OCA\Files_External\MountConfig::$skipTest = false;
|
||||||
self::$hookCalls = [];
|
self::$hookCalls = [];
|
||||||
if ($this->dbConfig) {
|
if ($this->dbConfig) {
|
||||||
$this->dbConfig->clean();
|
$this->dbConfig->clean();
|
||||||
|
|
|
@ -106,7 +106,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
|
||||||
current(self::$hookCalls),
|
current(self::$hookCalls),
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
$storage->getMountPoint(),
|
$storage->getMountPoint(),
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
$this->userId
|
$this->userId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class UserStoragesServiceTest extends StoragesServiceTest {
|
||||||
self::$hookCalls[1],
|
self::$hookCalls[1],
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
'/mountpoint',
|
'/mountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
$this->userId
|
$this->userId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -178,19 +178,19 @@ class UserStoragesServiceTest extends StoragesServiceTest {
|
||||||
self::$hookCalls[0],
|
self::$hookCalls[0],
|
||||||
Filesystem::signal_delete_mount,
|
Filesystem::signal_delete_mount,
|
||||||
'/mountpoint',
|
'/mountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
$this->userId
|
$this->userId
|
||||||
);
|
);
|
||||||
$this->assertHookCall(
|
$this->assertHookCall(
|
||||||
self::$hookCalls[1],
|
self::$hookCalls[1],
|
||||||
Filesystem::signal_create_mount,
|
Filesystem::signal_create_mount,
|
||||||
'/renamedMountpoint',
|
'/renamedMountpoint',
|
||||||
\OC_Mount_Config::MOUNT_TYPE_USER,
|
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
|
||||||
$this->userId
|
$this->userId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testGetAdminStorage() {
|
public function testGetAdminStorage() {
|
||||||
$this->expectException(\OCA\Files_External\NotFoundException::class);
|
$this->expectException(\OCA\Files_External\NotFoundException::class);
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class AdminTest extends TestCase {
|
||||||
'storages' => ['a', 'b', 'c'],
|
'storages' => ['a', 'b', 'c'],
|
||||||
'backends' => ['d', 'e', 'f'],
|
'backends' => ['d', 'e', 'f'],
|
||||||
'authMechanisms' => ['g', 'h', 'i'],
|
'authMechanisms' => ['g', 'h', 'i'],
|
||||||
'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()),
|
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||||
'allowUserMounting' => true,
|
'allowUserMounting' => true,
|
||||||
'globalCredentials' => 'asdf:asdf',
|
'globalCredentials' => 'asdf:asdf',
|
||||||
'globalCredentialsUid' => '',
|
'globalCredentialsUid' => '',
|
||||||
|
|
|
@ -110,7 +110,7 @@ class File implements \OCP\Encryption\IFile {
|
||||||
|
|
||||||
// check if it is a group mount
|
// check if it is a group mount
|
||||||
if (\OCP\App::isEnabled("files_external")) {
|
if (\OCP\App::isEnabled("files_external")) {
|
||||||
$mounts = \OC_Mount_Config::getSystemMountPoints();
|
$mounts = \OCA\Files_External\MountConfig::getSystemMountPoints();
|
||||||
foreach ($mounts as $mount) {
|
foreach ($mounts as $mount) {
|
||||||
if ($mount['mountpoint'] == substr($ownerPath, 1, strlen($mount['mountpoint']))) {
|
if ($mount['mountpoint'] == substr($ownerPath, 1, strlen($mount['mountpoint']))) {
|
||||||
$mountedFor = $this->util->getUserWithAccessToMountPoint($mount['applicable']['users'], $mount['applicable']['groups']);
|
$mountedFor = $this->util->getUserWithAccessToMountPoint($mount['applicable']['users'], $mount['applicable']['groups']);
|
||||||
|
|
|
@ -299,7 +299,7 @@ class Util {
|
||||||
*/
|
*/
|
||||||
public function isSystemWideMountPoint($path, $uid) {
|
public function isSystemWideMountPoint($path, $uid) {
|
||||||
if (\OCP\App::isEnabled("files_external")) {
|
if (\OCP\App::isEnabled("files_external")) {
|
||||||
$mounts = \OC_Mount_Config::getSystemMountPoints();
|
$mounts = \OCA\Files_External\MountConfig::getSystemMountPoints();
|
||||||
foreach ($mounts as $mount) {
|
foreach ($mounts as $mount) {
|
||||||
if (strpos($path, '/files/' . $mount['mountpoint']) === 0) {
|
if (strpos($path, '/files/' . $mount['mountpoint']) === 0) {
|
||||||
if ($this->isMountPointApplicableToUser($mount, $uid)) {
|
if ($this->isMountPointApplicableToUser($mount, $uid)) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ class ExceptionSerializer {
|
||||||
'storeKeyPair',
|
'storeKeyPair',
|
||||||
'setupUser',
|
'setupUser',
|
||||||
|
|
||||||
// files_external: OC_Mount_Config
|
// files_external: OCA\Files_External\MountConfig
|
||||||
'getBackendStatus',
|
'getBackendStatus',
|
||||||
|
|
||||||
// files_external: UserStoragesController
|
// files_external: UserStoragesController
|
||||||
|
|
Loading…
Reference in New Issue