Skip to content

Commit

Permalink
don't apply acls when scanning
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Nov 27, 2023
1 parent fe0278e commit f4a0fb1
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions lib/Mount/GroupFolderStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
use OC\Files\Cache\Scanner;
use OC\Files\ObjectStore\ObjectStoreScanner;
use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\Storage\Wrapper\Jail;
use OC\Files\Storage\Wrapper\Quota;
use OCA\GroupFolders\ACL\ACLStorageWrapper;
use OCP\Files\Cache\ICacheEntry;
use OCP\IUser;
use OCP\IUserSession;
Expand Down Expand Up @@ -70,10 +72,31 @@ public function getCache($path = '', $storage = null) {
}

public function getScanner($path = '', $storage = null) {
/** @var \OC\Files\Storage\Storage $storage */
if (!$storage) {
$storage = $this;
// note that we explicitly don't used the passed in storage
// as we want to perform the scan on the underlying filesystem
// without any of the group folder permissions applied

$storage = $this->storage;

// we want to scan without ACLs applied
if ($storage->instanceOfStorage(ACLStorageWrapper::class)) {
// sanity check in case the code setting up the wrapper hierarchy is changed without updating this
if (!$this->storage instanceof Jail) {
throw new \Exception("groupfolder storage layout changed unexpectedly");
}

$jailRoot = $this->storage->getUnjailedPath('');
$aclStorage = $this->storage->getUnjailedStorage();

if (!$aclStorage instanceof ACLStorageWrapper) {
throw new \Exception("groupfolder storage layout changed unexpectedly");
}
$storage = new Jail([
'storage' => $aclStorage->getWrapperStorage(),
'root' => $jailRoot,
]);
}

if ($storage->instanceOfStorage(ObjectStoreStorage::class)) {
$storage->scanner = new ObjectStoreScanner($storage);
} elseif (!isset($storage->scanner)) {
Expand Down

0 comments on commit f4a0fb1

Please sign in to comment.