response->getStatus() !== ServerStatus::OK) { return; } if (!$this->isUserLoggedIn() || !$this->hasUserPermission($this->jsonBody->userId)) { return; } try { $sharing = new Sharing(); $sharing->setUserId($this->jsonBody->userId); $sharing->setUserShared($this->jsonBody->userSharedId); $sharing->Save(); $this->response = new ApiJsonResponse(); $this->response->setParameter('sharingId', $sharing->getSharingId()); } catch (Throwable $e) { $this->response = new ApiJsonResponse(ServerStatus::BAD_REQUEST); $this->response->setMessage($e->getMessage()); } } }