|
|
@ -26,6 +26,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
namespace OC\Files\ObjectStore; |
|
|
|
namespace OC\Files\ObjectStore; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Exception; |
|
|
|
use OCP\Files\IHomeStorage; |
|
|
|
use OCP\Files\IHomeStorage; |
|
|
|
use OCP\IUser; |
|
|
|
use OCP\IUser; |
|
|
|
|
|
|
|
|
|
|
@ -34,17 +35,19 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The home user storage requires a user object to create a unique storage id |
|
|
|
* The home user storage requires a user object to create a unique storage id |
|
|
|
|
|
|
|
* |
|
|
|
* @param array $params |
|
|
|
* @param array $params |
|
|
|
|
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function __construct($params) { |
|
|
|
public function __construct($params) { |
|
|
|
if (! isset($params['user']) || ! $params['user'] instanceof IUser) { |
|
|
|
if (! isset($params['user']) || ! $params['user'] instanceof IUser) { |
|
|
|
throw new \Exception('missing user object in parameters'); |
|
|
|
throw new Exception('missing user object in parameters'); |
|
|
|
} |
|
|
|
} |
|
|
|
$this->user = $params['user']; |
|
|
|
$this->user = $params['user']; |
|
|
|
parent::__construct($params); |
|
|
|
parent::__construct($params); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getId() { |
|
|
|
public function getId(): string { |
|
|
|
return 'object::user:' . $this->user->getUID(); |
|
|
|
return 'object::user:' . $this->user->getUID(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -52,13 +55,10 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage |
|
|
|
* get the owner of a path |
|
|
|
* get the owner of a path |
|
|
|
* |
|
|
|
* |
|
|
|
* @param string $path The path to get the owner |
|
|
|
* @param string $path The path to get the owner |
|
|
|
* @return false|string uid |
|
|
|
* @return string uid |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getOwner($path) { |
|
|
|
public function getOwner($path): string { |
|
|
|
if (is_object($this->user)) { |
|
|
|
return $this->user->getUID(); |
|
|
|
return $this->user->getUID(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getUser(): IUser { |
|
|
|
public function getUser(): IUser { |
|
|
|