Example #1
0
    def get(self, task_id):
        task = tasks_service.get_task(task_id)
        if not permissions.has_manager_permissions():
            user_service.check_has_task_related(task["project_id"])

        result = task
        task_type = tasks_service.get_task_type(task["task_type_id"])
        result["task_type"] = task_type
        assigner = persons_service.get_person(task["assigner_id"])
        result["assigner"] = assigner
        project = projects_service.get_project(task["project_id"])
        result["project"] = project
        task_status = tasks_service.get_task_status(task["task_status_id"])
        result["task_status"] = task_status
        entity = tasks_service.get_entity(task["entity_id"])
        result["entity"] = entity
        if entity["parent_id"] is not None:
            sequence = shots_service.get_sequence(entity["parent_id"])
            result["sequence"] = sequence
            if sequence["parent_id"] is not None:
                episode = shots_service.get_episode(sequence["parent_id"])
                result["episode"] = episode
        entity_type = tasks_service.get_entity_type(entity["entity_type_id"])
        result["entity_type"] = entity_type
        assignees = []
        for assignee_id in task["assignees"]:
            assignees.append(persons_service.get_person(assignee_id))
        result["persons"] = assignees
        result["type"] = "Task"

        return result, 200
Example #2
0
    def post(self, asset_instance_id):
        args = self.get_arguments()

        try:
            revision = int(args["revision"])
            try:
                working_file = files_service.get_working_file(
                    args["working_file_id"]
                )
                working_file_id = working_file["id"]
            except WorkingFileNotFoundException:
                pass
            asset_instance = assets_service.get_asset_instance(
                asset_instance_id
            )

            entity = assets_service.get_asset(asset_instance["asset_id"])
            if not permissions.has_manager_permissions():
                user_service.check_has_task_related(entity["project_id"])

            output_type = files_service.get_output_type(args["output_type_id"])
            task_type = tasks_service.get_task_type(args["task_type_id"])
            if args["person_id"] is None:
                person = persons_service.get_current_user()
            else:
                person = persons_service.get_person(args["person_id"])

            output_file = files_service.create_new_output_revision(
                asset_instance["asset_id"],
                working_file_id,
                output_type["id"],
                person["id"],
                task_type["id"],
                asset_instance_id=asset_instance["id"],
                revision=revision,
                name=args["name"],
                representation=args["representation"],
                comment=args["comment"],
                extension=args["extension"]
            )

            output_file_dict = self.add_path_info(
                output_file,
                "output",
                asset_instance,
                output_type,
                task_type=task_type,
                name=args["name"],
                extension=args["extension"],
                representation=args["representation"],
                separator=args["sep"]
            )
        except OutputTypeNotFoundException:
            return {"message": "Cannot find given output type."}, 400
        except PersonNotFoundException:
            return {"message": "Cannot find given person."}, 400
        except EntryAlreadyExistsException:
            return {"message": "The given output file already exists."}, 400

        return output_file_dict, 201
Example #3
0
 def is_allowed(self, project_id):
     try:
         if not permissions.has_manager_permissions():
             user_service.check_has_task_related(project_id)
         return True
     except permissions.PermissionDenied:
         return False
Example #4
0
 def put(self, working_file_id):
     comment = self.get_comment_from_args()
     working_file = files_service.get_working_file(working_file_id)
     task = tasks_service.get_task(working_file["task_id"])
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(task["project_id"])
     working_file = self.update_comment(working_file_id, comment)
     return working_file
Example #5
0
 def get(self, shot_id):
     """
     Resource to retrieve the casting of a given shot.
     """
     shot = shots_service.get_shot(shot_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(shot["project_id"])
     return breakdown_service.get_casting(shot_id)
Example #6
0
    def get(self, task_id):
        result = {}
        task = tasks_service.get_task(task_id)
        if not permissions.has_manager_permissions():
            user_service.check_has_task_related(task["project_id"])
        result = files_service.get_working_files_for_task(task["id"])

        return result
Example #7
0
 def is_allowed(self, asset_id):
     asset = assets_service.get_asset(asset_id)
     try:
         if not permissions.has_manager_permissions():
             user_service.check_has_task_related(asset.project_id)
         return True
     except permissions.PermissionDenied:
         return False
Example #8
0
 def get(self, scene_id):
     """
     Retrieve all tasks related to a given scene.
     """
     scene = shots_service.get_scene(scene_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(scene["project_id"])
     return tasks_service.get_tasks_for_scene(scene_id)
Example #9
0
 def get(self, shot_id):
     """
     Retrieve all task types related to a given shot.
     """
     shot = shots_service.get_shot(shot_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(shot["project_id"])
     return tasks_service.get_task_types_for_shot(shot_id)
Example #10
0
 def get(self, entity_id, task_type_id):
     entity = entities_service.get_entity(entity_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(entity["project_id"])
     return tasks_service.get_tasks_for_entity_and_task_type(
         entity_id,
         task_type_id
     )
Example #11
0
 def get(self, project_id):
     """
     Retrieve all asset types for given project.
     """
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(project_id)
     asset_types = assets_service.get_asset_types_for_project(project_id)
     return asset_types
Example #12
0
 def get(self, asset_id):
     """
     Resource to retrieve the casting of a given asset.
     """
     asset = assets_service.get_asset(asset_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(asset["project_id"])
     return breakdown_service.get_cast_in(asset_id)
Example #13
0
 def get(self, asset_id):
     """
     Retrieve all task types related to a given asset.
     """
     asset = assets_service.get_asset(asset_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(asset["project_id"])
     return tasks_service.get_task_types_for_asset(asset_id)
Example #14
0
 def get(self, asset_id):
     """
     Retrieve given asset.
     """
     asset = assets_service.get_full_asset(asset_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(asset["project_id"])
     return asset
Example #15
0
 def is_allowed(self, shot_id):
     shot = shots_service.get_shot(shot_id)
     try:
         if not permissions.has_manager_permissions():
             user_service.check_has_task_related(shot.project_id)
         return True
     except permissions.PermissionDenied:
         return False
Example #16
0
 def get(self, shot_id):
     """
     Retrieve all assets for a given shot.
     """
     shot = shots_service.get_shot(shot_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(shot["project_id"])
     return shots_service.get_entities_out(shot_id)
Example #17
0
 def get(self, project_id):
     """
     Retrieve all shots related to a given project.
     """
     projects_service.get_project(project_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(project_id)
     return shots_service.get_scenes_for_project(project_id)
Example #18
0
 def get(self, asset_instance_id):
     asset_instance = assets_service.get_asset_instance(asset_instance_id)
     entity = entities_service.get_entity(asset_instance["asset_id"])
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(entity["project_id"])
     return files_service.get_last_output_files_for_instance(
         asset_instance["id"]
     )
Example #19
0
 def get(self, sequence_id):
     """
     Retrieve given sequence.
     """
     sequence = shots_service.get_full_sequence(sequence_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(sequence["project_id"])
     return sequence
Example #20
0
 def get(self, episode_id):
     """
     Retrieve given episode.
     """
     episode = shots_service.get_full_episode(episode_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(episode["project_id"])
     return episode
Example #21
0
 def get(self, task_id, date):
     try:
         task = tasks_service.get_task(task_id)
         if not permissions.has_manager_permissions():
             user_service.check_has_task_related(task.project_id)
         return tasks_service.get_time_spents(task_id)
     except WrongDateFormatException:
         abort(404)
Example #22
0
 def get(self, shot_id):
     """
     Retrieve all asset shots for given soht.
     """
     shot = shots_service.get_shot(shot_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(shot["project_id"])
     asset_types = assets_service.get_asset_types_for_shot(shot_id)
     return asset_types
Example #23
0
 def is_allowed(self, working_file_id):
     working_file = files_service.get_working_file(working_file_id)
     task = tasks_service.get_task(working_file["task_id"])
     try:
         if not permissions.has_manager_permissions():
             user_service.check_has_task_related(task.project_id)
         return True
     except permissions.PermissionDenied:
         return False
Example #24
0
 def put(self, working_file_id):
     working_file = files_service.get_working_file(working_file_id)
     task = tasks_service.get_task(working_file["task_id"])
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(task["project_id"])
     working_file = files_service.update_working_file(
         working_file_id,
         {"updated_at": datetime.datetime.utcnow()}
     )
     return working_file
Example #25
0
 def get(self, project_id):
     """
     Retrieve all assets for given project.
     """
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(project_id)
     criterions = query.get_query_criterions_from_request(request)
     criterions["project_id"] = project_id
     assets = assets_service.get_assets(criterions)
     return assets
Example #26
0
 def is_allowed(self, preview_file_id):
     if permissions.has_manager_permissions():
         return True
     else:
         preview_file = files_service.get_preview_file(preview_file_id)
         task = tasks_service.get_task(preview_file["task_id"])
         try:
             user_service.check_has_task_related(task["project_id"])
             return True
         except permissions.PermissionDenied:
             return False
Example #27
0
 def get(self, sequence_id):
     """
     Retrieve all shot entries for a given sequence.
     Filters can be specified in the query string.
     """
     sequence = shots_service.get_sequence(sequence_id)
     if not permissions.has_manager_permissions():
         user_service.check_has_task_related(sequence["project_id"])
     criterions = query.get_query_criterions_from_request(request)
     criterions["parent_id"] = sequence_id
     return shots_service.get_shots(criterions)
Example #28
0
    def get(self, file_id):
        try:
            file_dict = files_service.get_working_file(file_id)
            task = tasks_service.get_task(file_dict["task_id"])
            project_id = task["project_id"]
        except WorkingFileNotFoundException:
            file_dict = files_service.get_output_file(file_id)
            entity = entities_service.get_entity(file_dict["entity_id"])
            project_id = entity["project_id"]

        if not permissions.has_manager_permissions():
            user_service.check_has_task_related(project_id)
        return file_dict
Example #29
0
 def check_read_permissions(self, instance):
     if permissions.has_manager_permissions():
         return True
     else:
         asset_instance = self.get_model_or_404(instance["id"])
         asset = assets_service.get_asset(asset_instance.id)
         return user_service.check_has_task_related(asset["project_id"])
Example #30
0
 def check_read_permissions(self, instance):
     if permissions.has_manager_permissions():
         return True
     else:
         comment = self.get_model_or_404(instance["id"])
         task = tasks_service.get_task(comment.object_id)
         return user_service.check_has_task_related(task["project_id"])