Merge pull request #20584 from owncloud/fileinfo-owner-external-share
Fix getOwner for external shares
This commit is contained in:
commit
da5285dc23
|
@ -260,4 +260,9 @@ class Storage extends DAV implements ISharedStorage {
|
|||
|
||||
return json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
public function getOwner($path) {
|
||||
list(, $remote) = explode('://', $this->remote, 2);
|
||||
return $this->remoteUser . '@' . $remote;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,11 +46,13 @@ namespace OC\Files;
|
|||
use Icewind\Streams\CallbackWrapper;
|
||||
use OC\Files\Cache\Updater;
|
||||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\User\User;
|
||||
use OCP\Files\FileNameTooLongException;
|
||||
use OCP\Files\InvalidCharacterInPathException;
|
||||
use OCP\Files\InvalidPathException;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\ReservedWordException;
|
||||
use OCP\IUser;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
use OCP\Lock\LockedException;
|
||||
|
||||
|
@ -1163,6 +1165,19 @@ class View {
|
|||
return $this->basicOperation('hasUpdated', $path, array(), $time);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ownerId
|
||||
* @return \OC\User\User
|
||||
*/
|
||||
private function getUserObjectForOwner($ownerId) {
|
||||
$owner = \OC::$server->getUserManager()->get($ownerId);
|
||||
if ($owner instanceof IUser) {
|
||||
return $owner;
|
||||
} else {
|
||||
return new User($ownerId, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the filesystem info
|
||||
*
|
||||
|
@ -1250,7 +1265,7 @@ class View {
|
|||
$data['permissions'] |= \OCP\Constants::PERMISSION_DELETE;
|
||||
}
|
||||
|
||||
$owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath));
|
||||
$owner = $this->getUserObjectForOwner($storage->getOwner($internalPath));
|
||||
return new FileInfo($path, $storage, $internalPath, $data, $mount, $owner);
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1332,7 @@ class View {
|
|||
if (\OCP\Util::isSharingDisabledForUser()) {
|
||||
$content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE;
|
||||
}
|
||||
$owner = \OC::$server->getUserManager()->get($storage->getOwner($content['path']));
|
||||
$owner = $this->getUserObjectForOwner($storage->getOwner($content['path']));
|
||||
$files[] = new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner);
|
||||
}
|
||||
|
||||
|
@ -1387,7 +1402,7 @@ class View {
|
|||
$rootEntry['permissions'] = $rootEntry['permissions'] & ~\OCP\Constants::PERMISSION_SHARE;
|
||||
}
|
||||
|
||||
$owner = \OC::$server->getUserManager()->get($subStorage->getOwner(''));
|
||||
$owner = $this->getUserObjectForOwner($subStorage->getOwner(''));
|
||||
$files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue