Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable26] don't apply acls when scanning #2733

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions lib/Mount/GroupFolderStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
use OC\Files\Cache\Scanner;
use OC\Files\ObjectStore\NoopScanner;
use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\Storage\Wrapper\Jail;
use OC\Files\Storage\Wrapper\Quota;
use OC\Files\Storage\Wrapper\Wrapper;
use OCA\GroupFolders\ACL\ACLStorageWrapper;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Storage\IDisableEncryptionStorage;
use OCP\IUser;
Expand Down Expand Up @@ -71,10 +74,32 @@ 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

/** @var Wrapper $storage */
$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 NoopScanner($storage);
} elseif (!isset($storage->scanner)) {
Expand Down
Loading