public function get(PFUser $user, Planning_Milestone $milestone)
 {
     $artifact = $milestone->getArtifact();
     $field = $artifact->getABurndownField($user);
     if (!$field) {
         throw new RestException(404);
     }
     $rest = $field->getRESTValue($user, $artifact->getLastChangeset());
     Header::allowOptionsGet();
     return $rest->value;
 }
 private function sendPaginationHeaders($limit, $offset, $size)
 {
     Header::sendPaginationHeaders($limit, $offset, $size, $this->file_manager->getMaximumChunkSize());
 }
 private function sendETagHeader(Tracker_Artifact $artifact)
 {
     Header::eTag($artifact->getVersionIdentifier());
 }
 /**
  * Return info about repository if exists
  *
  * @url OPTIONS {id}
  *
  * @param string $id Id of the repository
  *
  * @throws 403
  * @throws 404
  */
 public function optionsId($id)
 {
     Header::allowOptionsGet();
 }
Esempio n. 5
0
 /**
  * @url OPTIONS {id}/columns
  *
  * <pre>
  * /!\ Kanban REST routes are under construction and subject to changes /!\
  * </pre>
  *
  * @param string $id Id of the Kanban
  */
 public function optionsColumns($id)
 {
     Header::allowOptionsPostPut();
 }
 private function sendAllowHeadersForBurndown()
 {
     Header::allowOptionsGet();
 }
Esempio n. 7
0
 /**
  * Update card content
  *
  * Things to take into account:
  * <ol>
  *  <li>You will get an error (400) if there are no changes in submitted document</li>
  *  <li>You can re-use the same document provided by /milestones/:id/cardwall cards
  *      section. Even if it contains more data. The extra data/info will be ignored</li>
  *  <li>You don't need to set all 'values' of the card, you can restrict to the modified ones</li>
  *  <li>If the card embbed in 'values' a field that correspond to 'label' or 'column_id'
  *      (ie. that might happens if the status is displayed on the card). The data submitted
  *      in 'values' section will override whatever was set in 'label' or 'column_id'</li>
  * </ol>
  *
  * @url PUT {id}
  * @param string $id        Id of the card (format: planningId_artifactId, @see milestones/:id/cardwall)
  * @param string $label     Label of the card {@from body}
  * @param array  $values    Card's fields values {@from body}
  * @param int    $column_id Where the card should stands {@from body}
  *
  */
 protected function putId($id, $label, array $values, $column_id = null)
 {
     try {
         $current_user = $this->user_manager->getCurrentUser();
         $single_card = $this->getSingleCard($current_user, $id);
         $card_updater = new CardUpdater();
         $card_updater->updateCard($current_user, $single_card, $label, $values, $column_id);
     } catch (Tracker_FormElement_InvalidFieldException $exception) {
         throw new RestException(400, $exception->getMessage());
     } catch (Tracker_Exception $exception) {
         if ($GLOBALS['Response']->feedbackHasErrors()) {
             throw new RestException(400, $GLOBALS['Response']->getRawFeedback());
         }
         throw new RestException(400, $exception->getMessage());
     }
     Header::allowOptionsPut();
 }
 /**
  * Get artifacts
  *
  * Get artifacts matching criteria of a report.
  *
  * <p>
  * By default it does not return the values of the fields for performance reasons.
  * You can ask to include some specific values with the <strong>values</strong> parameter.<br>
  * Eg:
  * <ul>
  *  <li>…?id=123&values=summary,status //add summary and status values
  *  <li>…?id=123&values=all            //add all fields values
  *  <li>…?id=123&values=               //(empty string) do not add any field values
  * </ul>
  * </p>
  *
  * <p>
  *   <strong>/!\</strong> Please note that <strong>only "all" and "" (empty string) are available</strong> for now.
  * </p>
  *
  * @url GET {id}/artifacts
  * @access hybrid
  *
  * @param int    $id      Id of the report
  * @param string $values  Which fields to include in the response. Default is no field values {@from path}{@choice ,all}
  * @param int    $limit   Number of elements displayed per page {@from path}{@min 1}
  * @param int    $offset  Position of the first element to display {@from path}{@min 0}
  *
  * @return array {@type Tuleap\Tracker\REST\Artifact\ArtifactRepresentation}
  */
 public function getArtifacts($id, $values = self::DEFAULT_VALUES, $limit = self::DEFAULT_LIMIT, $offset = self::DEFAULT_OFFSET)
 {
     $this->checkAccess();
     $this->checkLimitValue($limit);
     $user = UserManager::instance()->getCurrentUser();
     $report = $this->getReportById($user, $id);
     $matching_ids = $report->getMatchingIds();
     if (!$matching_ids['id']) {
         return array();
     }
     $matching_artifact_ids = explode(',', $matching_ids['id']);
     $nb_matching = count($matching_artifact_ids);
     $slice_matching_ids = array_slice($matching_artifact_ids, $offset, $limit);
     $artifact_factory = Tracker_ArtifactFactory::instance();
     $artifacts = $artifact_factory->getArtifactsByArtifactIdList($slice_matching_ids);
     $with_all_field_values = $values == self::ALL_VALUES;
     Header::allowOptionsGet();
     Header::sendPaginationHeaders($limit, $offset, $nb_matching, self::MAX_LIMIT);
     return $this->getListOfArtifactRepresentation($user, $artifacts, $with_all_field_values);
 }
 private function sendLocationHeader($uri)
 {
     $uri_with_api_version = '/api/v1/' . $uri;
     Header::Location($uri_with_api_version);
 }
Esempio n. 10
0
 private function sendAllowHeadersForMilestones()
 {
     Header::allowOptionsGet();
 }
Esempio n. 11
0
 private function sendAllowHeaders()
 {
     Header::allowOptionsGetPatch();
 }
Esempio n. 12
0
 /**
  * @url OPTIONS
  *
  * <pre>
  * /!\ Kanban REST routes are under construction and subject to changes /!\
  * </pre>
  */
 public function options()
 {
     Header::allowOptionsPatchDelete();
 }
 private function sendAllowHeaderForCardwall()
 {
     Header::allowOptionsGet();
 }
Esempio n. 14
0
 /**
  * @url OPTIONS {id}/versions
  */
 public function optionsVersions($id)
 {
     Header::allowOptionsGet();
 }
 private function sendPaginationHeaders($limit, $offset, $size)
 {
     Header::sendPaginationHeaders($limit, $offset, $size, self::MAX_LIMIT);
 }
 private function sendPaginationHeaders($limit, $offset, $size)
 {
     Header::sendPaginationHeaders($limit, $offset, $size, FileManager::getMaximumChunkSize());
 }
Esempio n. 17
0
 /**
  * @url OPTIONS
  *
  * <pre>
  * /!\ Kanban REST routes are under construction and subject to changes /!\
  * </pre>
  */
 public function options()
 {
     Header::allowOptionsGetPost();
 }
Esempio n. 18
0
 /**
  * Delete Kanban
  *
  * Delete Kanban
  *
  * @url DELETE {id}
  * @access protected
  *
  * <pre>
  * /!\ Kanban REST routes are under construction and subject to changes /!\
  * </pre>
  *
  * @param string $id Id of the kanban
  */
 protected function delete($id)
 {
     $user = $this->getCurrentUser();
     $kanban = $this->getKanban($user, $id);
     $this->checkUserCanUpdateKanban($user, $kanban);
     $this->kanban_dao->delete($id);
     Header::allowOptionsGetPatchDelete();
 }
Esempio n. 19
0
 private function sendAllowHeader()
 {
     Header::allowOptionsGet();
 }
Esempio n. 20
0
 private function sendAllowHeadersForToken()
 {
     Header::allowOptionsDelete();
 }