/** * @NoAdminRequired */ public function joinAsUser($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 = array('permissions' => $info['permissions'], 'id' => $fileId); } $response = array_merge($response, array('status' => 'success')); } catch (\Exception $e) { $this->logger->warning('Starting a session failed. Reason: ' . $e->getMessage(), array('app' => $this->appName)); $response = array('status' => 'error'); } return $response; }