Try to return the owner of the mountpoint before returning no owner

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-03-16 16:08:07 +01:00
parent e3b0817ec9
commit 73827c97e4
No known key found for this signature in database
GPG key ID: 7076EA9751AACDDA
2 changed files with 10 additions and 2 deletions

View file

@ -24,6 +24,7 @@ namespace OCA\GroupFolders\Mount;
use OC\Files\Storage\Wrapper\Quota;
use OCP\Files\Cache\ICacheEntry;
use OCP\IUser;
use OCP\IUserSession;
class GroupFolderStorage extends Quota {
@ -35,6 +36,8 @@ class GroupFolderStorage extends Quota {
/** @var IUserSession */
private $userSession;
/** @var IUser */
private $mountOwner;
public $cache;
@ -43,6 +46,7 @@ class GroupFolderStorage extends Quota {
$this->folderId = $parameters['folder_id'];
$this->rootEntry = $parameters['rootCacheEntry'];
$this->userSession = $parameters['userSession'];
$this->mountOwner = $parameters['mountOwner'];
}
public function getFolderId() {
@ -51,7 +55,10 @@ class GroupFolderStorage extends Quota {
public function getOwner($path) {
$user = $this->userSession->getUser();
return $user !== null ? $user->getUID() : false;
if ($user !== null) {
return $user->getUID();
}
return $this->mountOwner !== null ? $this->mountOwner->getUID() : false;
}
public function instanceOfStorage($class) {

View file

@ -150,7 +150,8 @@ class MountProvider implements IMountProvider {
'quota' => $quota,
'folder_id' => $id,
'rootCacheEntry' => $cacheEntry,
'userSession' => $this->userSession
'userSession' => $this->userSession,
'mountOwner' => $user,
]);
$maskedStore = new PermissionsMask([
'storage' => $quotaStorage,