Example #1
0
 /**
  * Get a specific share by id
  *
  * @param string $id
  * @return \OC_OCS_Result
  */
 public function getShare($id)
 {
     // Try both our default, and our federated provider..
     $share = null;
     // First check if it is an internal share.
     try {
         $share = $this->shareManager->getShareById('ocinternal:' . $id);
     } catch (\OC\Share20\Exception\ShareNotFound $e) {
         // Ignore for now
         //return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
     }
     if ($share === null) {
         //For now federated shares are handled by the old endpoint.
         return \OCA\Files_Sharing\API\Local::getShare(['id' => $id]);
     }
     if ($this->canAccessShare($share)) {
         $share = $this->formatShare($share);
         return new \OC_OCS_Result($share);
     } else {
         return new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
     }
 }
Example #2
0
File: api.php Project: evanjt/core
 /**
  * @medium
  */
 function testGetShareFromUnknownId()
 {
     $params = array('id' => 0);
     $result = \OCA\Files_Sharing\API\Local::getShare($params);
     $this->assertEquals(404, $result->getStatusCode());
     $meta = $result->getMeta();
     $this->assertEquals('share doesn\'t exist', $meta['message']);
 }
Example #3
0
 public function getShare($params)
 {
     return \OCA\Files_Sharing\API\Local::getShare($params);
 }