def copy_file(P, req): uid = UR.getUserId(req) if not auth.canMoveFile(uid, P["source_id"]): return UR.prepare_response({}, 1, "NOT ALLOWED") if P["target_type"] == "ensemble": if not auth.canInsertFile(uid, P["target_id"]): return UR.prepare_response({}, 1, "NOT ALLOWED") elif P["target_type"] == "folder": folder = M.Folder.objects.get(pk=P["target_id"]) if not auth.canInsertFile(uid, folder.ensemble.pk, folder.pk): return UR.prepare_response({}, 1, "NOT ALLOWED") else: return UR.prepare_response({}, 1, "INVALID ARGUMENT") new_source_id = annotations.copy_file(uid, P) return UR.prepare_response({ "id_source": new_source_id })
def move_file(P,req): uid = UR.getUserId(req) if not auth.canMoveFile(uid, P["id"]): return UR.prepare_response({}, 1, "NOT ALLOWED") return UR.prepare_response({"files": annotations.move_file(uid, P)})
def move_file(P, req): uid = UR.getUserId(req) if not auth.canMoveFile(uid, P["id"]): return UR.prepare_response({}, 1, "NOT ALLOWED") return UR.prepare_response({"files": annotations.move_file(uid, P)})