public function __construct($fileId, $shareOps = null, $token = '')
{
if (!$fileId) {
throw new \Exception('No valid file has been passed');
}
$this->fileId = $fileId;
$this->sharing = $shareOps;
$this->token = $token;
if ($this->isPublicShare()) {
if (isset($this->sharing['uid_owner'])) {
$this->owner = $this->sharing['uid_owner'];
if (!\OC::$server->getUserManager()->userExists($this->sharing['uid_owner'])) {
throw new \Exception('Share owner' . $this->sharing['uid_owner'] . ' does not exist ');
}
\OC_Util::tearDownFS();
\OC_Util::setupFS($this->sharing['uid_owner']);
} else {
throw new \Exception($this->fileId . ' is a broken share');
}
} else {
$this->owner = \OC::$server->getUserSession()->getUser()->getUID();
}
$this->initViews();
}