Exemple #1
0
 protected function run($argument)
 {
     $remote = $argument['remote'];
     $id = (int) $argument['id'];
     $token = $argument['token'];
     $try = (int) $argument['try'] + 1;
     $result = $this->notifications->sendRemoteUnShare($remote, $id, $token, $try);
     if ($result === true || $try > $this->maxTry) {
         $this->retainJob = false;
     }
 }
 /**
  * Delete a share
  *
  * @param IShare $share
  */
 public function delete(IShare $share)
 {
     $qb = $this->dbConnection->getQueryBuilder();
     $qb->delete('share')->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())));
     $qb->execute();
     list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith());
     $this->notifications->sendRemoteUnShare($remote, $share->getId(), $share->getToken());
 }
 /**
  * in case of a re-share we need to send the other use (initiator or owner)
  * a message that the file was unshared
  *
  * @param IShare $share
  * @param bool $isOwner the user can either be the owner or the user who re-sahred it
  * @throws ShareNotFound
  * @throws \OC\HintException
  */
 protected function revokeShare($share, $isOwner)
 {
     // also send a unShare request to the initiator, if this is a different user than the owner
     if ($share->getShareOwner() !== $share->getSharedBy()) {
         if ($isOwner) {
             list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
         } else {
             list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner());
         }
         $remoteId = $this->getRemoteId($share);
         $this->notifications->sendRevokeShare($remote, $remoteId, $share->getToken());
     }
 }
Exemple #4
0
 protected function run($argument)
 {
     $remote = $argument['remote'];
     $remoteId = $argument['remoteId'];
     $token = $argument['token'];
     $action = $argument['action'];
     $data = json_decode($argument['data'], true);
     $try = (int) $argument['try'] + 1;
     $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try);
     if ($result === true || $try > $this->maxTry) {
         $this->retainJob = false;
     }
 }
 /**
  * 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();
 }