|
|
|
|
@ -28,6 +28,7 @@ use OCP\Files\Mount\IMountPoint;
|
|
|
|
|
use OCP\Files\NotFoundException;
|
|
|
|
|
use OCP\Files\ReservedWordException;
|
|
|
|
|
use OCP\IUser;
|
|
|
|
|
use OCP\IUserManager;
|
|
|
|
|
use OCP\Lock\ILockingProvider;
|
|
|
|
|
use OCP\Lock\LockedException;
|
|
|
|
|
use OCP\Server;
|
|
|
|
|
@ -1364,7 +1365,7 @@ class View {
|
|
|
|
|
|
|
|
|
|
$ownerId = $storage->getOwner($internalPath);
|
|
|
|
|
$owner = null;
|
|
|
|
|
if ($ownerId !== null && $ownerId !== false) {
|
|
|
|
|
if ($ownerId !== false) {
|
|
|
|
|
// ownerId might be null if files are accessed with an access token without file system access
|
|
|
|
|
$owner = $this->getUserObjectForOwner($ownerId);
|
|
|
|
|
}
|
|
|
|
|
@ -1450,7 +1451,12 @@ class View {
|
|
|
|
|
if ($sharingDisabled) {
|
|
|
|
|
$content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE;
|
|
|
|
|
}
|
|
|
|
|
$owner = $this->getUserObjectForOwner($storage->getOwner($content['path']));
|
|
|
|
|
$ownerId = $storage->getOwner($content['path']);
|
|
|
|
|
if ($ownerId !== false) {
|
|
|
|
|
$owner = $this->getUserObjectForOwner($ownerId);
|
|
|
|
|
} else {
|
|
|
|
|
$owner = null;
|
|
|
|
|
}
|
|
|
|
|
return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner);
|
|
|
|
|
}, $contents);
|
|
|
|
|
$files = array_combine($fileNames, $fileInfos);
|
|
|
|
|
@ -1527,7 +1533,12 @@ class View {
|
|
|
|
|
$rootEntry['permissions'] = $rootEntry['permissions'] & ~\OCP\Constants::PERMISSION_SHARE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$owner = $this->getUserObjectForOwner($subStorage->getOwner(''));
|
|
|
|
|
$ownerId = $subStorage->getOwner('');
|
|
|
|
|
if ($ownerId !== false) {
|
|
|
|
|
$owner = $this->getUserObjectForOwner($ownerId);
|
|
|
|
|
} else {
|
|
|
|
|
$owner = null;
|
|
|
|
|
}
|
|
|
|
|
$files[$rootEntry->getName()] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1644,7 +1655,12 @@ class View {
|
|
|
|
|
$internalPath = $result['path'];
|
|
|
|
|
$path = $mountPoint . $result['path'];
|
|
|
|
|
$result['path'] = substr($mountPoint . $result['path'], $rootLength);
|
|
|
|
|
$owner = $userManager->get($storage->getOwner($internalPath));
|
|
|
|
|
$ownerId = $storage->getOwner($internalPath);
|
|
|
|
|
if ($ownerId !== false) {
|
|
|
|
|
$owner = $userManager->get($ownerId);
|
|
|
|
|
} else {
|
|
|
|
|
$owner = null;
|
|
|
|
|
}
|
|
|
|
|
$files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1663,7 +1679,12 @@ class View {
|
|
|
|
|
$internalPath = $result['path'];
|
|
|
|
|
$result['path'] = rtrim($relativeMountPoint . $result['path'], '/');
|
|
|
|
|
$path = rtrim($mountPoint . $internalPath, '/');
|
|
|
|
|
$owner = $userManager->get($storage->getOwner($internalPath));
|
|
|
|
|
$ownerId = $storage->getOwner($internalPath);
|
|
|
|
|
if ($ownerId !== false) {
|
|
|
|
|
$owner = $userManager->get($ownerId);
|
|
|
|
|
} else {
|
|
|
|
|
$owner = null;
|
|
|
|
|
}
|
|
|
|
|
$files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1811,7 +1832,12 @@ class View {
|
|
|
|
|
$mount = $this->getMount($path);
|
|
|
|
|
$storage = $mount->getStorage();
|
|
|
|
|
$internalPath = $mount->getInternalPath($this->getAbsolutePath($path));
|
|
|
|
|
$owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath));
|
|
|
|
|
$ownerId = $storage->getOwner($internalPath);
|
|
|
|
|
if ($ownerId !== false) {
|
|
|
|
|
$owner = Server::get(IUserManager::class)->get($ownerId);
|
|
|
|
|
} else {
|
|
|
|
|
$owner = null;
|
|
|
|
|
}
|
|
|
|
|
return new FileInfo(
|
|
|
|
|
$this->getAbsolutePath($path),
|
|
|
|
|
$storage,
|
|
|
|
|
@ -1846,7 +1872,7 @@ class View {
|
|
|
|
|
|
|
|
|
|
// Short cut for read-only validation
|
|
|
|
|
if ($readonly) {
|
|
|
|
|
$validator = \OCP\Server::get(FilenameValidator::class);
|
|
|
|
|
$validator = Server::get(FilenameValidator::class);
|
|
|
|
|
if ($validator->isForbidden($fileName)) {
|
|
|
|
|
$l = \OCP\Util::getL10N('lib');
|
|
|
|
|
throw new InvalidPathException($l->t('Filename is a reserved word'));
|
|
|
|
|
|