Cross user access

pull/1/head
Victor Dubiniuk 11 years ago committed by Tobias Hintze
parent 5b165331df
commit 7b86f75955

@ -1,20 +0,0 @@
<?php
// TODO:
// * this thing needs to support HEAD and GET requests.
//
// * the url shall look like: http://whatever/owncloud/index.php/apps/office/ajax/genesis.php/1234
// 1234 is the session id here; a database table maps that to a file in storage
//
// * GET requests have to support ranges
// curl --user admin:admin -r 500-1000 -i http://whatever/owncloud/index.php/apps/office/ajax/genesis.php/1234
namespace OCA\Office;
\OCP\User::checkLoggedIn();
$session = Session::getSession(@$_SERVER['QUERY_STRING']);
$filename = isset($session['genesis_url']) ? $session['genesis_url'] : '';
$download = new Download($filename);
$download->sendResponse();

@ -9,19 +9,20 @@ class Download {
protected $instance;
public function __construct($filepath){
public function __construct($view, $filepath){
$this->filepath = $filepath;
$this->view = $view;
if (isset($_SERVER['HTTP_RANGE'])) {
$this->instance = new Download\Range($filepath);
$this->instance = new Download\Range($view, $filepath);
} else {
$this->instance = new Download\Simple($filepath);
$this->instance = new Download\Simple($view, $filepath);
}
}
public function sendResponse(){
\OCP\Response::disableCaching();
$this->view = View::initOfficeView(\OCP\User::getUser());
if (!$this->fileExists()){
$this->sendNotFound();

@ -9,7 +9,8 @@ class Range extends \OCA\Office\Download {
// End of the range
protected $end;
public function __construct($filepath){
public function __construct($view, $filepath){
$this->view = $view;
$this->filepath = $filepath;
}

@ -5,7 +5,8 @@ use OCA\Office\View;
class Simple extends \OCA\Office\Download {
public function __construct($filepath){
public function __construct($view, $filepath){
$this->view = $view;
$this->filepath = $filepath;
}

@ -10,7 +10,10 @@ class Genesis {
$session = Session::getSession(@$args['es_id']);
$filename = isset($session['genesis_url']) ? $session['genesis_url'] : '';
$download = new Download($filename);
$officeView = View::initOfficeView($session['owner']);
$download = new Download($officeView, $filename);
$download->sendResponse();
}

Loading…
Cancel
Save