Esempio n. 1
0
 /**
  *
  * @SWG\Api(
  *   path="/projects/{project_uuid}/history/",
  *   description="API for project actions",
  * @SWG\Operation(
  *    method="GET",
  *    nickname="Project History",
  *    type="ProjectHistory",
  *    summary="Returns the history of a project",
  * @SWG\Parameter(
  *     name="project_uuid",
  *     description="The unique ID of the project",
  *     paramType="path",
  *     required=true,
  *     type="string"
  *     )
  *   )
  * )
  */
 private function get_project_history($uuid)
 {
     validate_team_read(get_team_id());
     $project = validate_project_uuid($uuid);
     $project_history = $this->Project_Statistic->get_project_history($project->id);
     $this->response($project_history);
 }
Esempio n. 2
0
 /**
  *
  * @SWG\Api(
  *   path="/project/{project_uuid}",
  *   description="API for activity actions",
  * @SWG\Operation(
  *    method="GET",
  *    type="array[Activity]",
  *    summary="Returns a list of the current activities that belong to the project in descending chronological order",
  *    @SWG\Parameter(
  *       name="page",
  *       description="The starting page # of the activities (defaults to 0)",
  *       paramType="query",
  *       required=false,
  *       type="integer"
  *     ),
  *    @SWG\Parameter(
  *       name="limit",
  *       description="The number of results to return per page (defaults to 20)",
  *       paramType="query",
  *       required=false,
  *       type="integer"
  *     ),
  *    @SWG\Parameter(
  *       name="project_uuid",
  *       description="The UUID of the project that this activity is attached to",
  *       paramType="path",
  *       required=true,
  *       type="string"
  *     ),
  *   )
  * )
  */
 public function project_get($uuid = '')
 {
     $project = validate_project_uuid($uuid);
     validate_team_read(get_team_id());
     $activities = $this->Activity->get_for_project($project->id, $this->get('page', TRUE), $this->get('limit', TRUE));
     $this->response($this->decorate_objects($activities));
 }
Esempio n. 3
0
 /**
  * Returns a single meeting referenced by their uuid
  * @param string $uuid
  */
 public function meeting_get($uuid = '', $action = '')
 {
     validate_team_read(get_team_id());
     if ($action) {
         if ($action == 'chat') {
             return $this->meeting_chat_get($uuid);
         } else {
             if ($action === 'delta') {
                 return $this->meeting_delta_get($uuid);
             } else {
                 if ($action === 'participants') {
                     return $this->meeting_participants($uuid);
                 }
             }
         }
     } else {
         $meeting = validate_meeting_uuid($uuid);
         $this->response($this->decorate_object($meeting));
     }
 }
Esempio n. 4
0
 /**
  * Returns either a screen or a list of hotspots for that screen depending on what the action is
  * @param string $uuid
  * @param string $action
  */
 public function screen_get($uuid = '', $action = '')
 {
     validate_team_read(get_team_id());
     $screen = validate_screen_uuid($uuid);
     if ($action && $action === 'hotspots') {
         $hotspots = $this->Hotspot->get_for_screen($screen->id);
         $this->response(decorate_hotspots($hotspots));
     } else {
         if ($action && $action === 'comments') {
             $comments = $this->Comment->get_for_screen($screen->id);
             $this->response(decorate_comments($comments));
         } else {
             if ($action && $action === 'drawings') {
                 $drawings = $this->Drawing->get_for_screen($screen->id);
                 $this->response(decorate_drawings($drawings));
             } else {
                 $this->response($this->decorate_object($screen));
             }
         }
     }
 }
Esempio n. 5
0
 /**
  *
  * @SWG\Api(
  *   path="/team/{uuid}/invite",
  *   description="API for team actions",
  * @SWG\Operation(
  *    method="POST",
  *    type="Response",
  *    summary="Invite a user to a team.  You can only invite people who are not already on your team.",
  * @SWG\Parameter(
  *     name="uuid",
  *     description="UUID of the team",
  *     paramType="path",
  *     required=true,
  *     type="string"
  *     ),
  * @SWG\Parameter(
  *     name="email",
  *     description="The email address of the user you would like to invite",
  *     paramType="form",
  *     required=true,
  *     type="string"
  *     )
  *   )
  * )
  *
  * Invites a user to a team
  * @param string $uuid
  */
 private function team_invite($uuid = '')
 {
     $this->load->library('form_validation');
     $this->load->helper('notification');
     /* Only the team owner can invite people */
     $team = validate_team_uuid($uuid, true);
     validate_team_read($team->id);
     /* Validate that they are the team owner */
     validate_team_owner($team->id, get_user_id());
     /* Validate that they have a valid subscription and can add a team */
     validate_user_add(get_user_id());
     $this->form_validation->set_rules('email', 'Email', 'required|trim|xss_clean|valid_email');
     if ($this->form_validation->run() == FALSE) {
         json_error('There was a problem with your submission: ' . validation_errors(' ', ' '));
     } else {
         $email = $this->post('email', TRUE);
         /* Look to see if there is an existing invite and resend it */
         $invite = $this->Team_Invite->get_for_email_team($email, $team->id);
         $invite_id = 0;
         if ($invite && !$invite->user_id) {
             $invite_id = $invite->id;
             $key = $invite->key;
         } else {
             $key = random_string('unique');
             $invite_id = $this->Team_Invite->add(array('email' => $email, 'team_id' => $team->id, 'key' => $key));
         }
         notify_team_invite($invite_id, get_user_id());
         json_success("User invited successfully", array('invite_id' => $invite_id, 'email' => $email, 'key' => $key));
     }
 }
Esempio n. 6
0
 /**
  * Deletes a hotspot by its uuid
  * @param string $uuid
  */
 public function hotspot_delete($uuid = '')
 {
     validate_team_read(get_team_id());
     $hotspot = validate_hotspot_uuid($uuid);
     activity_delete_hotspot($hotspot->id);
     $this->Hotspot->delete($hotspot->id);
     json_success("Hotspot deleted successfully.");
 }
Esempio n. 7
0
 /**
  * Returns a single message referenced by their uuid
  * @param string $uuid
  */
 public function message_get($uuid = '')
 {
     validate_team_read(get_team_id());
     $message = validate_message_uuid($uuid);
     $this->response($this->decorate_object($message));
 }
Esempio n. 8
0
 /**
  * Deletes a drawing by its uuid
  * @param string $uuid
  */
 public function drawing_delete($uuid = '')
 {
     validate_team_read(get_team_id());
     $drawing = validate_drawing_uuid($uuid);
     activity_delete_drawing($drawing->id);
     $this->Drawing->delete($drawing->id);
     json_success("Drawing deleted successfully.");
 }