Example #1
0
    def put(self):
        (task_ids) = self.get_arguments()

        for task_id in task_ids:
            try:
                tasks_service.clear_assignation(task_id)
            except TaskNotFoundException:
                pass
        return task_ids
Example #2
0
    def put(self):
        (task_ids) = self.get_arguments()

        if len(task_ids) > 0:
            task = tasks_service.get_task(task_ids[0])
            user_service.check_manager_project_access(task["project_id"])

        for task_id in task_ids:
            try:
                tasks_service.clear_assignation(task_id)
            except TaskNotFoundException:
                pass
        return task_ids
Example #3
0
    def put(self):
        """
        Remove all assignations set to given task.
        ---
        tags:
        - Tasks
        parameters:
          - in: body
            name: Task
            description: List of tasks ID and person ID
            schema:
                type: object
                required:
                  - task_ids
                properties:
                    task_ids:
                        type: UUID
                        example: a24a6ea4-ce75-4665-a070-57453082c25
                    person_id:
                        type: UUID  
                        example: a24a6ea4-ce75-4665-a070-57453082c25
        responses:
            200:
                description: All assignations removed
        """
        (task_ids, person_id) = self.get_arguments()
        current_user = persons_service.get_current_user()

        for task_id in task_ids:
            task = tasks_service.get_task(task_id, relations=True)
            if not (current_user["id"] in task["assignees"]
                    and current_user["id"] == task["assigner_id"]):
                user_service.check_manager_project_access(task["project_id"])

        for task_id in task_ids:
            try:
                tasks_service.clear_assignation(task_id, person_id=person_id)
            except TaskNotFoundException:
                pass
        return task_ids
Example #4
0
 def test_clear_assignation(self):
     task_id = self.task.id
     tasks_service.assign_task(self.task.id, self.person.id)
     tasks_service.clear_assignation(task_id)
     task = tasks_service.get_task(task_id)
     self.assertEquals(len(task["assignees"]), 0)