diff --git a/lib/Listener/BeforeFileSystemSetupListener.php b/lib/Listener/BeforeFileSystemSetupListener.php deleted file mode 100644 index 3bc618b2..00000000 --- a/lib/Listener/BeforeFileSystemSetupListener.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ -class BeforeFileSystemSetupListener implements IEventListener { - public function __construct( - private readonly GuestManager $guestManager, - ) { - } - - #[\Override] - public function handle(Event $event): void { - if ($event instanceof BeforeFileSystemSetupEvent) { - $this->setupReadonlyFilesystem($event); - } - } - - public function setupReadonlyFilesystem(BeforeFileSystemSetupEvent $event): void { - $user = $event->getUser(); - - if ($this->guestManager->isGuest($user)) { - Filesystem::addStorageWrapper('guests.readonly', function ($mountPoint, IStorage $storage) use ($user): ReadOnlyJail|IStorage { - if ($mountPoint === sprintf('/%s/', $user->getUID())) { - return new ReadOnlyJail([ - 'storage' => $storage, - 'mask' => Constants::PERMISSION_READ, - 'path' => 'files' - ]); - } - - return $storage; - }); - } - } -} diff --git a/lib/RestrictionManager.php b/lib/RestrictionManager.php index 8b3c222b..17184bb9 100644 --- a/lib/RestrictionManager.php +++ b/lib/RestrictionManager.php @@ -12,10 +12,7 @@ use OC\AppConfig; use OC\NavigationManager; use OCA\Files_External\Config\ExternalMountPoint; -use OCA\Guests\Listener\BeforeFileSystemSetupListener; -use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IMountProviderCollection; -use OCP\Files\Events\BeforeFileSystemSetupEvent; use OCP\Files\Mount\IMountPoint; use OCP\INavigationManager; use OCP\IRequest; @@ -38,7 +35,6 @@ public function __construct( private readonly Config $config, private readonly UserBackend $userBackend, private readonly LoggerInterface $logger, - private readonly IEventDispatcher $eventDispatcher, ) { } @@ -56,8 +52,6 @@ public function setupRestrictions(): void { } if ($this->guestManager->isGuest($user)) { - $this->eventDispatcher->addServiceListener(BeforeFileSystemSetupEvent::class, BeforeFileSystemSetupListener::class); - if (!$this->config->allowExternalStorage()) { $this->mountProviderCollection->registerMountFilter(fn (IMountPoint $mountPoint, IUser $user): bool => !($mountPoint instanceof ExternalMountPoint && $this->guestManager->isGuest($user))); } diff --git a/lib/Storage/ReadOnlyJail.php b/lib/Storage/ReadOnlyJail.php deleted file mode 100644 index 82bd8114..00000000 --- a/lib/Storage/ReadOnlyJail.php +++ /dev/null @@ -1,27 +0,0 @@ -getWrapperStorage()->isDeletable($path); - } -}