Exemplo n.º 1
0
 /**
  * decline server-to-server share
  *
  * @param array $params
  * @return \OC_OCS_Result
  */
 public function declineShare($params)
 {
     if (!$this->isS2SEnabled()) {
         return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing');
     }
     $id = (int) $params['id'];
     $token = isset($_POST['token']) ? $_POST['token'] : null;
     try {
         $share = $this->federatedShareProvider->getShareById($id);
     } catch (Share\Exceptions\ShareNotFound $e) {
         return new \OC_OCS_Result();
     }
     if ($this->verifyShare($share, $token)) {
         if ($share->getShareOwner() !== $share->getSharedBy()) {
             list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
             $remoteId = $this->federatedShareProvider->getRemoteId($share);
             $this->notifications->sendDeclineShare($remote, $remoteId, $share->getToken());
         }
         $this->executeDeclineShare($share);
     }
     return new \OC_OCS_Result();
 }