From 0ab59053fb5e63614b9ac5c94fbecff66a48b8c1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 13 Sep 2024 09:21:39 -0500 Subject: Put views behind authorisation. --- uploader/samples/views.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'uploader') diff --git a/uploader/samples/views.py b/uploader/samples/views.py index 6e3dc4b..18a3bdd 100644 --- a/uploader/samples/views.py +++ b/uploader/samples/views.py @@ -39,6 +39,7 @@ from .models import samples_by_species_and_population samplesbp = Blueprint("samples", __name__) @samplesbp.route("/samples", methods=["GET"]) +@require_login def index(): """Direct entry-point for uploading/handling the samples.""" with database_connection(app.config["SQL_URI"]) as conn: @@ -56,6 +57,7 @@ def index(): @samplesbp.route("/samples/select-population", methods=["GET"]) +@require_login def select_population(species_id: int): """Select the population to use for the samples.""" with database_connection(app.config["SQL_URI"]) as conn: @@ -86,6 +88,7 @@ def select_population(species_id: int): population_id=population["Id"])) @samplesbp.route("/populations//samples") +@require_login def list_samples(species_id: int, population_id: int): """ List the samples in a particular population and give the ability to upload @@ -224,6 +227,7 @@ def upload_samples(species_id: int, population_id: int):#pylint: disable=[too-ma @samplesbp.route("/populations//" "upload-samples/status/", methods=["GET"]) +@require_login def upload_status(species_id: int, population_id: int, job_id: uuid.UUID): """Check on the status of a samples upload job.""" with database_connection(app.config["SQL_URI"]) as conn: @@ -273,6 +277,7 @@ def upload_status(species_id: int, population_id: int, job_id: uuid.UUID): population=population), 400 @samplesbp.route("/upload/failure/", methods=["GET"]) +@require_login def upload_failure(job_id: uuid.UUID): """Display the errors of the samples upload failure.""" job = with_redis_connection(lambda rconn: jobs.job( -- cgit v1.2.3