diff options
Diffstat (limited to 'lib/public/Files')
-rw-r--r-- | lib/public/Files/Config/IMountProviderCollection.php | 10 | ||||
-rw-r--r-- | lib/public/Files/Config/IUserMountCache.php | 26 | ||||
-rw-r--r-- | lib/public/Files/Events/InvalidateMountCacheEvent.php | 55 |
3 files changed, 90 insertions, 1 deletions
diff --git a/lib/public/Files/Config/IMountProviderCollection.php b/lib/public/Files/Config/IMountProviderCollection.php index f845d72cee6..5894d06a388 100644 --- a/lib/public/Files/Config/IMountProviderCollection.php +++ b/lib/public/Files/Config/IMountProviderCollection.php @@ -39,6 +39,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> $mountProviderClass + * @return \OCP\Files\Mount\IMountPoint[] + * @since 24.0.0 + */ + public function getUserMountsForProviderClass(IUser $user, string $mountProviderClass); + + /** * Get the configured home mount for this user * * @param \OCP\IUser $user diff --git a/lib/public/Files/Config/IUserMountCache.php b/lib/public/Files/Config/IUserMountCache.php index 08f95990d3c..4411200c7ae 100644 --- a/lib/public/Files/Config/IUserMountCache.php +++ b/lib/public/Files/Config/IUserMountCache.php @@ -25,6 +25,7 @@ namespace OCP\Files\Config; use OCP\Files\Mount\IMountPoint; +use OCP\Files\NotFoundException; use OCP\IUser; /** @@ -38,9 +39,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 @@ -125,4 +127,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; } diff --git a/lib/public/Files/Events/InvalidateMountCacheEvent.php b/lib/public/Files/Events/InvalidateMountCacheEvent.php new file mode 100644 index 00000000000..6508e168d4c --- /dev/null +++ b/lib/public/Files/Events/InvalidateMountCacheEvent.php @@ -0,0 +1,55 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2022 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/>. + * + */ + +namespace OCP\Files\Events; + +use OCP\EventDispatcher\Event; +use OCP\IUser; + +/** + * Used to notify the filesystem setup manager that the available mounts for a user have changed + * + * @since 24.0.0 + */ +class InvalidateMountCacheEvent extends Event { + private ?IUser $user; + + /** + * @param IUser|null $user user + * + * @since 24.0.0 + */ + public function __construct(?IUser $user) { + parent::__construct(); + $this->user = $user; + } + + /** + * @return IUser|null user + * + * @since 24.0.0 + */ + public function getUser(): ?IUser { + return $this->user; + } +} |