Big update, corpus analysis reworked, versioned services, preliminary work for contributions

This commit is contained in:
Patrick Jentsch
2022-02-03 12:39:16 +01:00
parent 0647537192
commit fe938c0ca2
36 changed files with 1552 additions and 431 deletions

View File

@@ -34,12 +34,14 @@ def delete_job(job_id):
@login_required
def download_job_input(job_id, job_input_id):
job_input = JobInput.query.filter(JobInput.job_id == job_id, JobInput.id == job_input_id).first_or_404() # noqa
if not (job_input.job.user == current_user
or current_user.is_administrator()):
if not (job_input.job.user == current_user or current_user.is_administrator()): # noqa
abort(403)
return send_from_directory(as_attachment=True,
directory=os.path.dirname(job_input.path),
filename=job_input.filename)
return send_from_directory(
as_attachment=True,
attachment_filename=job_input.filename,
directory=os.path.dirname(job_input.path),
filename=os.path.basename(job_input.path)
)
@bp.route('/<hashid:job_id>/restart')
@@ -59,9 +61,11 @@ def restart(job_id):
@login_required
def download_job_result(job_id, job_result_id):
job_result = JobResult.query.filter(JobResult.job_id == job_id, JobResult.id == job_result_id).first_or_404() # noqa
if not (job_result.job.user == current_user
or current_user.is_administrator()):
if not (job_result.job.user == current_user or current_user.is_administrator()): # noqa
abort(403)
return send_from_directory(as_attachment=True,
directory=os.path.dirname(job_result.path),
filename=job_result.filename)
return send_from_directory(
as_attachment=True,
attachment_filename=job_result.filename,
directory=os.path.dirname(job_result.path),
filename=os.path.basename(job_result.path)
)