Fix filesystem setup for shared public link with logged in user
This commit is contained in:
parent
301baf0215
commit
c958d5ba80
|
@ -5,7 +5,6 @@ if (isset($_GET['file'])) {
|
||||||
$pos = strpos($_GET['file'], '/', 1);
|
$pos = strpos($_GET['file'], '/', 1);
|
||||||
$uidOwner = substr($_GET['file'], 1, $pos - 1);
|
$uidOwner = substr($_GET['file'], 1, $pos - 1);
|
||||||
if (OCP\User::userExists($uidOwner)) {
|
if (OCP\User::userExists($uidOwner)) {
|
||||||
OC_Util::tearDownFS();
|
|
||||||
OC_Util::setupFS($uidOwner);
|
OC_Util::setupFS($uidOwner);
|
||||||
$file = substr($_GET['file'], $pos);
|
$file = substr($_GET['file'], $pos);
|
||||||
$fileSource = OC_Filecache::getId($_GET['file'], '');
|
$fileSource = OC_Filecache::getId($_GET['file'], '');
|
||||||
|
|
18
lib/util.php
18
lib/util.php
|
@ -19,6 +19,18 @@ class OC_Util {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we are not forced to load a specific user we load the one that is logged in
|
||||||
|
if( $user == "" && OC_User::isLoggedIn()){
|
||||||
|
$user = OC_User::getUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
// the filesystem will finish when $user is not empty,
|
||||||
|
// mark fs setup here to avoid doing the setup from loading
|
||||||
|
// OC_Filesystem
|
||||||
|
if ($user != '') {
|
||||||
|
self::$fsSetup=true;
|
||||||
|
}
|
||||||
|
|
||||||
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
|
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
|
||||||
//first set up the local "root" storage
|
//first set up the local "root" storage
|
||||||
if(!self::$rootMounted){
|
if(!self::$rootMounted){
|
||||||
|
@ -26,11 +38,6 @@ class OC_Util {
|
||||||
self::$rootMounted=true;
|
self::$rootMounted=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are not forced to load a specific user we load the one that is logged in
|
|
||||||
if( $user == "" && OC_User::isLoggedIn()){
|
|
||||||
$user = OC_User::getUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem
|
if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem
|
||||||
$user_dir = '/'.$user.'/files';
|
$user_dir = '/'.$user.'/files';
|
||||||
$user_root = OC_User::getHome($user);
|
$user_root = OC_User::getHome($user);
|
||||||
|
@ -43,7 +50,6 @@ class OC_Util {
|
||||||
OC_Filesystem::init($user_dir);
|
OC_Filesystem::init($user_dir);
|
||||||
$quotaProxy=new OC_FileProxy_Quota();
|
$quotaProxy=new OC_FileProxy_Quota();
|
||||||
OC_FileProxy::register($quotaProxy);
|
OC_FileProxy::register($quotaProxy);
|
||||||
self::$fsSetup=true;
|
|
||||||
// Load personal mount config
|
// Load personal mount config
|
||||||
if (is_file($user_root.'/mount.php')) {
|
if (is_file($user_root.'/mount.php')) {
|
||||||
$mountConfig = include($user_root.'/mount.php');
|
$mountConfig = include($user_root.'/mount.php');
|
||||||
|
|
Loading…
Reference in New Issue