aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files/Config
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Files/Config')
-rw-r--r--lib/public/Files/Config/Event/UserMountAddedEvent.php26
-rw-r--r--lib/public/Files/Config/Event/UserMountRemovedEvent.php26
-rw-r--r--lib/public/Files/Config/Event/UserMountUpdatedEvent.php27
-rw-r--r--lib/public/Files/Config/ICachedMountFileInfo.php27
-rw-r--r--lib/public/Files/Config/ICachedMountInfo.php56
-rw-r--r--lib/public/Files/Config/IHomeMountProvider.php23
-rw-r--r--lib/public/Files/Config/IMountProvider.php24
-rw-r--r--lib/public/Files/Config/IMountProviderCollection.php34
-rw-r--r--lib/public/Files/Config/IRootMountProvider.php22
-rw-r--r--lib/public/Files/Config/IUserMountCache.php53
10 files changed, 166 insertions, 152 deletions
diff --git a/lib/public/Files/Config/Event/UserMountAddedEvent.php b/lib/public/Files/Config/Event/UserMountAddedEvent.php
new file mode 100644
index 00000000000..8abd7512188
--- /dev/null
+++ b/lib/public/Files/Config/Event/UserMountAddedEvent.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Files\Config\Event;
+
+use OCP\EventDispatcher\Event;
+use OCP\Files\Config\ICachedMountInfo;
+
+/**
+ * Event emitted when a user mount was added.
+ *
+ * @since 32.0.0
+ */
+class UserMountAddedEvent extends Event {
+ public function __construct(
+ public readonly ICachedMountInfo $mountPoint,
+ ) {
+ parent::__construct();
+ }
+}
diff --git a/lib/public/Files/Config/Event/UserMountRemovedEvent.php b/lib/public/Files/Config/Event/UserMountRemovedEvent.php
new file mode 100644
index 00000000000..0de7cfc4a99
--- /dev/null
+++ b/lib/public/Files/Config/Event/UserMountRemovedEvent.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Files\Config\Event;
+
+use OCP\EventDispatcher\Event;
+use OCP\Files\Config\ICachedMountInfo;
+
+/**
+ * Event emitted when a user mount was removed.
+ *
+ * @since 32.0.0
+ */
+class UserMountRemovedEvent extends Event {
+ public function __construct(
+ public readonly ICachedMountInfo $mountPoint,
+ ) {
+ parent::__construct();
+ }
+}
diff --git a/lib/public/Files/Config/Event/UserMountUpdatedEvent.php b/lib/public/Files/Config/Event/UserMountUpdatedEvent.php
new file mode 100644
index 00000000000..f797bef134e
--- /dev/null
+++ b/lib/public/Files/Config/Event/UserMountUpdatedEvent.php
@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Files\Config\Event;
+
+use OCP\EventDispatcher\Event;
+use OCP\Files\Config\ICachedMountInfo;
+
+/**
+ * Event emitted when a user mount was moved.
+ *
+ * @since 32.0.0
+ */
+class UserMountUpdatedEvent extends Event {
+ public function __construct(
+ public readonly ICachedMountInfo $oldMountPoint,
+ public readonly ICachedMountInfo $newMountPoint,
+ ) {
+ parent::__construct();
+ }
+}
diff --git a/lib/public/Files/Config/ICachedMountFileInfo.php b/lib/public/Files/Config/ICachedMountFileInfo.php
index 17adf5a4209..a9b30d8ba6d 100644
--- a/lib/public/Files/Config/ICachedMountFileInfo.php
+++ b/lib/public/Files/Config/ICachedMountFileInfo.php
@@ -1,26 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
- *
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Files\Config;
/**
@@ -35,11 +18,11 @@ interface ICachedMountFileInfo extends ICachedMountInfo {
* @return string
* @since 13.0.0
*/
- public function getInternalPath();
+ public function getInternalPath(): string;
/**
* @return string
* @since 13.0.0
*/
- public function getPath();
+ public function getPath(): string;
}
diff --git a/lib/public/Files/Config/ICachedMountInfo.php b/lib/public/Files/Config/ICachedMountInfo.php
index bf7481e2ebb..cb9c0205d3d 100644
--- a/lib/public/Files/Config/ICachedMountInfo.php
+++ b/lib/public/Files/Config/ICachedMountInfo.php
@@ -1,26 +1,10 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCP\Files\Config;
use OCP\Files\Node;
@@ -36,31 +20,31 @@ interface ICachedMountInfo {
* @return IUser
* @since 9.0.0
*/
- public function getUser();
+ public function getUser(): IUser;
/**
* @return int the numeric storage id of the mount
* @since 9.0.0
*/
- public function getStorageId();
+ public function getStorageId(): int;
/**
* @return int the fileid of the root of the mount
* @since 9.0.0
*/
- public function getRootId();
+ public function getRootId(): int;
/**
- * @return Node the root node of the mount
+ * @return Node|null the root node of the mount
* @since 9.0.0
*/
- public function getMountPointNode();
+ public function getMountPointNode(): ?Node;
/**
* @return string the mount point of the mount for the user
* @since 9.0.0
*/
- public function getMountPoint();
+ public function getMountPoint(): string;
/**
* Get the id of the configured mount
@@ -68,7 +52,7 @@ interface ICachedMountInfo {
* @return int|null mount id or null if not applicable
* @since 9.1.0
*/
- public function getMountId();
+ public function getMountId(): ?int;
/**
* Get the internal path (within the storage) of the root of the mount
@@ -76,5 +60,21 @@ interface ICachedMountInfo {
* @return string
* @since 11.0.0
*/
- public function getRootInternalPath();
+ public function getRootInternalPath(): string;
+
+ /**
+ * Get the class of the mount provider that this mount originates from
+ *
+ * @return string
+ * @since 24.0.0
+ */
+ public function getMountProvider(): string;
+
+ /**
+ * Get a key that uniquely identifies the mount
+ *
+ * @return string
+ * @since 28.0.0
+ */
+ public function getKey(): string;
}
diff --git a/lib/public/Files/Config/IHomeMountProvider.php b/lib/public/Files/Config/IHomeMountProvider.php
index c0d4b0a80f3..b193e9ba22e 100644
--- a/lib/public/Files/Config/IHomeMountProvider.php
+++ b/lib/public/Files/Config/IHomeMountProvider.php
@@ -1,25 +1,10 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCP\Files\Config;
use OCP\Files\Storage\IStorageFactory;
diff --git a/lib/public/Files/Config/IMountProvider.php b/lib/public/Files/Config/IMountProvider.php
index 629b74b4fe6..b59813a866d 100644
--- a/lib/public/Files/Config/IMountProvider.php
+++ b/lib/public/Files/Config/IMountProvider.php
@@ -1,26 +1,10 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCP\Files\Config;
use OCP\Files\Storage\IStorageFactory;
diff --git a/lib/public/Files/Config/IMountProviderCollection.php b/lib/public/Files/Config/IMountProviderCollection.php
index a4131514662..db5188372c1 100644
--- a/lib/public/Files/Config/IMountProviderCollection.php
+++ b/lib/public/Files/Config/IMountProviderCollection.php
@@ -1,26 +1,10 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCP\Files\Config;
use OCP\IUser;
@@ -40,6 +24,16 @@ interface IMountProviderCollection {
public function getMountsForUser(IUser $user);
/**
+ * Get the configured mount points for the user from a specific mount provider
+ *
+ * @param \OCP\IUser $user
+ * @param class-string<IMountProvider>[] $mountProviderClasses
+ * @return \OCP\Files\Mount\IMountPoint[]
+ * @since 24.0.0
+ */
+ public function getUserMountsForProviderClasses(IUser $user, array $mountProviderClasses): array;
+
+ /**
* Get the configured home mount for this user
*
* @param \OCP\IUser $user
diff --git a/lib/public/Files/Config/IRootMountProvider.php b/lib/public/Files/Config/IRootMountProvider.php
index 48d2e9722d3..e2a32fc346a 100644
--- a/lib/public/Files/Config/IRootMountProvider.php
+++ b/lib/public/Files/Config/IRootMountProvider.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2020, Morris Jobke <hey@morrisjobke.de>
- *
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Files\Config;
use OCP\Files\Storage\IStorageFactory;
diff --git a/lib/public/Files/Config/IUserMountCache.php b/lib/public/Files/Config/IUserMountCache.php
index cdb95078bc8..a5b68ded66d 100644
--- a/lib/public/Files/Config/IUserMountCache.php
+++ b/lib/public/Files/Config/IUserMountCache.php
@@ -1,30 +1,14 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCP\Files\Config;
use OCP\Files\Mount\IMountPoint;
+use OCP\Files\NotFoundException;
use OCP\IUser;
/**
@@ -38,9 +22,10 @@ interface IUserMountCache {
*
* @param IUser $user
* @param IMountPoint[] $mounts
+ * @param array|null $mountProviderClasses
* @since 9.0.0
*/
- public function registerMounts(IUser $user, array $mounts);
+ public function registerMounts(IUser $user, array $mounts, ?array $mountProviderClasses = null);
/**
* Get all cached mounts for a user
@@ -111,7 +96,7 @@ interface IUserMountCache {
* Get the used space for users
*
* Note that this only includes the space in their home directory,
- * not any incoming shares or external storages.
+ * not any incoming shares or external storage.
*
* @param IUser[] $users
* @return int[] [$userId => $userSpace]
@@ -125,4 +110,26 @@ interface IUserMountCache {
* @since 20.0.0
*/
public function clear(): void;
+
+ /**
+ * Get all cached mounts for a user
+ *
+ * @param IUser $user
+ * @param string $path
+ * @return ICachedMountInfo
+ * @throws NotFoundException
+ * @since 24.0.0
+ */
+ public function getMountForPath(IUser $user, string $path): ICachedMountInfo;
+
+ /**
+ * Get all cached mounts for a user inside a path
+ *
+ * @param IUser $user
+ * @param string $path
+ * @return ICachedMountInfo[]
+ * @throws NotFoundException
+ * @since 24.0.0
+ */
+ public function getMountsInPath(IUser $user, string $path): array;
}