public function join($fileId)
{
try {
$view = \OC\Files\Filesystem::getView();
$path = $view->getPath($fileId);
if ($view->isUpdatable($path)) {
$file = new File($fileId);
$response = Db\Session::start($this->uid, $file);
} else {
$info = $view->getFileInfo($path);
$response = ['permissions' => $info['permissions'], 'id' => $fileId];
}
$response = array_merge($response, ['status' => 'success']);
} catch (\Exception $e) {
$this->logger->warning('Starting a session failed. Reason: ' . $e->getMessage(), ['app' => $this->appName]);
$response = ['status' => 'error'];
}
return $response;
}