Example #1
0
 public function updateProject($project_id, $name = null, $description = null, $owner_id = null, $identifier = null)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateProject', $project_id);
     $values = $this->filterValues(array('id' => $project_id, 'name' => $name, 'description' => $description, 'owner_id' => $owner_id, 'identifier' => $identifier));
     list($valid, ) = $this->projectValidator->validateModification($values);
     return $valid && $this->projectModel->update($values);
 }
Example #2
0
 public function createAction($project_id, $event_name, $action_name, array $params)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'createAction', $project_id);
     $values = array('project_id' => $project_id, 'event_name' => $event_name, 'action_name' => $action_name, 'params' => $params);
     list($valid, ) = $this->actionValidator->validateCreation($values);
     if (!$valid) {
         return false;
     }
     // Check if the action exists
     $actions = $this->actionManager->getAvailableActions();
     if (!isset($actions[$action_name])) {
         return false;
     }
     // Check the event
     $action = $this->actionManager->getAction($action_name);
     if (!in_array($event_name, $action->getEvents())) {
         return false;
     }
     $required_params = $action->getActionRequiredParameters();
     // Check missing parameters
     foreach ($required_params as $param => $value) {
         if (!isset($params[$param])) {
             return false;
         }
     }
     // Check extra parameters
     foreach ($params as $param => $value) {
         if (!isset($required_params[$param])) {
             return false;
         }
     }
     return $this->actionModel->create($values);
 }
Example #3
0
 public function createCategory($project_id, $name)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'createCategory', $project_id);
     $values = array('project_id' => $project_id, 'name' => $name);
     list($valid, ) = $this->categoryValidator->validateCreation($values);
     return $valid ? $this->categoryModel->create($values) : false;
 }
Example #4
0
 public function createTaskFile($project_id, $task_id, $filename, $blob)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'createTaskFile', $project_id);
     try {
         return $this->taskFileModel->uploadContent($task_id, $filename, $blob);
     } catch (ObjectStorageException $e) {
         $this->logger->error(__METHOD__ . ': ' . $e->getMessage());
         return false;
     }
 }
Example #5
0
 public function createTask($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0, $date_due = '', $description = '', $category_id = 0, $score = 0, $swimlane_id = 0, $priority = 0, $recurrence_status = 0, $recurrence_trigger = 0, $recurrence_factor = 0, $recurrence_timeframe = 0, $recurrence_basedate = 0, $reference = '')
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'createTask', $project_id);
     if ($owner_id !== 0 && !$this->projectPermissionModel->isAssignable($project_id, $owner_id)) {
         return false;
     }
     if ($this->userSession->isLogged()) {
         $creator_id = $this->userSession->getId();
     }
     $values = array('title' => $title, 'project_id' => $project_id, 'color_id' => $color_id, 'column_id' => $column_id, 'owner_id' => $owner_id, 'creator_id' => $creator_id, 'date_due' => $date_due, 'description' => $description, 'category_id' => $category_id, 'score' => $score, 'swimlane_id' => $swimlane_id, 'recurrence_status' => $recurrence_status, 'recurrence_trigger' => $recurrence_trigger, 'recurrence_factor' => $recurrence_factor, 'recurrence_timeframe' => $recurrence_timeframe, 'recurrence_basedate' => $recurrence_basedate, 'reference' => $reference, 'priority' => $priority);
     list($valid, ) = $this->taskValidator->validateCreation($values);
     return $valid ? $this->taskCreationModel->create($values) : false;
 }
Example #6
0
 public function getBoard($project_id)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getBoard', $project_id);
     return BoardFormatter::getInstance($this->container)->withProjectId($project_id)->withQuery($this->taskFinderModel->getExtendedQuery())->format();
 }
Example #7
0
 public function changeSwimlanePosition($project_id, $swimlane_id, $position)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'changeSwimlanePosition', $project_id);
     return $this->swimlaneModel->changePosition($project_id, $swimlane_id, $position);
 }
 public function removeAllProjectFiles($project_id)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'removeAllProjectFiles', $project_id);
     return $this->projectFileModel->removeAll($project_id);
 }
 public function getProjectUserRole($project_id, $user_id)
 {
     ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectUserRole', $project_id);
     return $this->projectUserRoleModel->getUserRole($project_id, $user_id);
 }