aboutsummaryrefslogtreecommitdiff
path: root/uploader/samples
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-09-13 09:21:39 -0500
committerFrederick Muriuki Muriithi2024-09-13 10:40:30 -0500
commit0ab59053fb5e63614b9ac5c94fbecff66a48b8c1 (patch)
treecc0d9a4edfd0b95279e90b0e2599c5528b9789e0 /uploader/samples
parent36fc8996fa830078866e17aab7d9c177c74c835b (diff)
downloadgn-uploader-0ab59053fb5e63614b9ac5c94fbecff66a48b8c1.tar.gz
Put views behind authorisation.
Diffstat (limited to 'uploader/samples')
-rw-r--r--uploader/samples/views.py5
1 files changed, 5 insertions, 0 deletions
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("<int:species_id>/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("<int:species_id>/populations/<int:population_id>/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("<int:species_id>/populations/<int:population_id>/"
"upload-samples/status/<uuid:job_id>",
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/<uuid:job_id>", 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(