Browse Source

Adjusting endpoints to authentication

When using http basic authentication, the endpoints receive the user as a parameter. This needed to be added to all password secured endpoints.
blunk 3 years ago
parent
commit
9743887d0a
39 changed files with 39 additions and 38 deletions
  1. 1 1
      pycs/frontend/endpoints/ListJobs.py
  2. 1 1
      pycs/frontend/endpoints/ListLabelProviders.py
  3. 1 1
      pycs/frontend/endpoints/ListModels.py
  4. 1 1
      pycs/frontend/endpoints/ListProjects.py
  5. 1 1
      pycs/frontend/endpoints/additional/FolderInformation.py
  6. 1 1
      pycs/frontend/endpoints/data/GetCroppedFile.py
  7. 1 1
      pycs/frontend/endpoints/data/GetFile.py
  8. 1 1
      pycs/frontend/endpoints/data/GetPreviousAndNextFile.py
  9. 1 1
      pycs/frontend/endpoints/data/GetResizedFile.py
  10. 1 1
      pycs/frontend/endpoints/data/RemoveFile.py
  11. 1 1
      pycs/frontend/endpoints/data/UploadFile.py
  12. 1 1
      pycs/frontend/endpoints/jobs/RemoveJob.py
  13. 1 1
      pycs/frontend/endpoints/labels/CreateLabel.py
  14. 1 1
      pycs/frontend/endpoints/labels/EditLabelName.py
  15. 1 1
      pycs/frontend/endpoints/labels/EditLabelParent.py
  16. 1 1
      pycs/frontend/endpoints/labels/ListLabelTree.py
  17. 1 1
      pycs/frontend/endpoints/labels/ListLabels.py
  18. 1 1
      pycs/frontend/endpoints/labels/RemoveLabel.py
  19. 1 1
      pycs/frontend/endpoints/pipelines/FitModel.py
  20. 1 1
      pycs/frontend/endpoints/pipelines/PredictBoundingBox.py
  21. 1 1
      pycs/frontend/endpoints/pipelines/PredictFile.py
  22. 1 1
      pycs/frontend/endpoints/pipelines/PredictModel.py
  23. 1 1
      pycs/frontend/endpoints/projects/CreateProject.py
  24. 1 1
      pycs/frontend/endpoints/projects/EditProjectDescription.py
  25. 1 1
      pycs/frontend/endpoints/projects/EditProjectName.py
  26. 1 1
      pycs/frontend/endpoints/projects/ExecuteExternalStorage.py
  27. 1 1
      pycs/frontend/endpoints/projects/ExecuteLabelProvider.py
  28. 1 1
      pycs/frontend/endpoints/projects/GetProjectModel.py
  29. 1 1
      pycs/frontend/endpoints/projects/ListProjectCollections.py
  30. 1 0
      pycs/frontend/endpoints/projects/ListProjectFiles.py
  31. 1 1
      pycs/frontend/endpoints/projects/RemoveProject.py
  32. 1 1
      pycs/frontend/endpoints/results/ConfirmResult.py
  33. 1 1
      pycs/frontend/endpoints/results/CreateResult.py
  34. 1 1
      pycs/frontend/endpoints/results/EditResultData.py
  35. 1 1
      pycs/frontend/endpoints/results/EditResultLabel.py
  36. 1 1
      pycs/frontend/endpoints/results/GetProjectResults.py
  37. 1 1
      pycs/frontend/endpoints/results/GetResults.py
  38. 1 1
      pycs/frontend/endpoints/results/RemoveResult.py
  39. 1 1
      pycs/frontend/endpoints/results/ResetResults.py

+ 1 - 1
pycs/frontend/endpoints/ListJobs.py

@@ -15,5 +15,5 @@ class ListJobs(View):
         # pylint: disable=invalid-name
         self.jobs = jobs
 
-    def dispatch_request(self):
+    def dispatch_request(self, user: str):
         return jsonify(self.jobs.list())

+ 1 - 1
pycs/frontend/endpoints/ListLabelProviders.py

@@ -12,5 +12,5 @@ class ListLabelProviders(View):
     methods = ['GET']
 
 
-    def dispatch_request(self):
+    def dispatch_request(self, user: str):
         return jsonify(LabelProvider.query.all())

+ 1 - 1
pycs/frontend/endpoints/ListModels.py

@@ -12,5 +12,5 @@ class ListModels(View):
     methods = ['GET']
 
 
-    def dispatch_request(self):
+    def dispatch_request(self, user: str):
         return jsonify(Model.query.all())

+ 1 - 1
pycs/frontend/endpoints/ListProjects.py

@@ -12,5 +12,5 @@ class ListProjects(View):
     methods = ['GET']
 
 
-    def dispatch_request(self):
+    def dispatch_request(self, user: str):
         return jsonify(Project.query.all())

+ 1 - 1
pycs/frontend/endpoints/additional/FolderInformation.py

@@ -14,7 +14,7 @@ class FolderInformation(View):
     """
     methods = ['POST']
 
-    def dispatch_request(self):
+    def dispatch_request(self, user: str):
         # extract request data
         data = request.get_json(force=True)
 

+ 1 - 1
pycs/frontend/endpoints/data/GetCroppedFile.py

@@ -19,7 +19,7 @@ class GetCroppedFile(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, file_id: int, resolution: str, crop_box: str):
+    def dispatch_request(self, user: str, file_id: int, resolution: str, crop_box: str):
         # get file from database
         file = File.get_or_404(file_id)
 

+ 1 - 1
pycs/frontend/endpoints/data/GetFile.py

@@ -13,7 +13,7 @@ class GetFile(View):
     # pylint: disable=arguments-differ
     methods = ['GET']
 
-    def dispatch_request(self, file_id: int):
+    def dispatch_request(self, user: str, file_id: int):
         file = File.get_or_404(file_id)
 
         abs_file_path = file.absolute_path

+ 1 - 1
pycs/frontend/endpoints/data/GetPreviousAndNextFile.py

@@ -12,7 +12,7 @@ class GetPreviousAndNextFile(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, file_id: int):
+    def dispatch_request(self, user: str, file_id: int):
         # get file from database
         file = File.get_or_404(file_id)
 

+ 1 - 1
pycs/frontend/endpoints/data/GetResizedFile.py

@@ -18,7 +18,7 @@ class GetResizedFile(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, file_id: int, resolution: str):
+    def dispatch_request(self, user: str, file_id: int, resolution: str):
         # get file from database
         file = File.get_or_404(file_id)
 

+ 1 - 1
pycs/frontend/endpoints/data/RemoveFile.py

@@ -17,7 +17,7 @@ class RemoveFile(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, file_id: int):
+    def dispatch_request(self, user: str, file_id: int):
         # extract request data
         data = request.get_json(force=True)
 

+ 1 - 1
pycs/frontend/endpoints/data/UploadFile.py

@@ -28,7 +28,7 @@ class UploadFile(View):
         self.extension = None
         self.size = None
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # find project
         project = Project.get_or_404(project_id)
 

+ 1 - 1
pycs/frontend/endpoints/jobs/RemoveJob.py

@@ -17,7 +17,7 @@ class RemoveJob(View):
         # pylint: disable=invalid-name
         self.jobs = jobs
 
-    def dispatch_request(self, job_id):
+    def dispatch_request(self, user: str, job_id):
         # extract request data
         data = request.get_json(force=True)
 

+ 1 - 1
pycs/frontend/endpoints/labels/CreateLabel.py

@@ -20,7 +20,7 @@ class CreateLabel(View):
         self.nm = nm
 
 
-    def dispatch_request(self, project_id):
+    def dispatch_request(self, user: str, project_id):
         # extract request data
         data = request.get_json(force=True)
         name = data.get('name')

+ 1 - 1
pycs/frontend/endpoints/labels/EditLabelName.py

@@ -19,7 +19,7 @@ class EditLabelName(View):
         self.nm = nm
 
 
-    def dispatch_request(self, project_id: int, label_id: int):
+    def dispatch_request(self, user: str, project_id: int, label_id: int):
         # extract request data
         data = request.get_json(force=True)
         name = data.get('name')

+ 1 - 1
pycs/frontend/endpoints/labels/EditLabelParent.py

@@ -19,7 +19,7 @@ class EditLabelParent(View):
         self.nm = nm
 
 
-    def dispatch_request(self, project_id: int, label_id: int):
+    def dispatch_request(self, user: str, project_id: int, label_id: int):
         # extract request data
         data = request.get_json(force=True)
         parent = data.get('parent')

+ 1 - 1
pycs/frontend/endpoints/labels/ListLabelTree.py

@@ -12,7 +12,7 @@ class ListLabelTree(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, project_id):
+    def dispatch_request(self, user: str, project_id):
         # find project
         project = Project.get_or_404(project_id)
 

+ 1 - 1
pycs/frontend/endpoints/labels/ListLabels.py

@@ -12,7 +12,7 @@ class ListLabels(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, project_id):
+    def dispatch_request(self, user: str, project_id):
         # find project
         project = Project.get_or_404(project_id)
 

+ 1 - 1
pycs/frontend/endpoints/labels/RemoveLabel.py

@@ -19,7 +19,7 @@ class RemoveLabel(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, project_id: int, label_id: int):
+    def dispatch_request(self, user: str, project_id: int, label_id: int):
         # extract request data
         data = request.get_json(force=True)
 

+ 1 - 1
pycs/frontend/endpoints/pipelines/FitModel.py

@@ -22,7 +22,7 @@ class FitModel(View):
         self.jobs = jobs
         self.pipelines = pipelines
 
-    def dispatch_request(self, project_id):
+    def dispatch_request(self, user: str, project_id):
         project = Project.get_or_404(project_id)
 
         # extract request data

+ 1 - 1
pycs/frontend/endpoints/pipelines/PredictBoundingBox.py

@@ -26,7 +26,7 @@ class PredictBoundingBox(View):
         self.jobs = jobs
         self.pipelines = pipelines
 
-    def dispatch_request(self, file_id, bbox_id):
+    def dispatch_request(self, user: str, file_id, bbox_id):
         # find file and result (=bounding box)
         # We need the result to get (x,y,w,h)
         file = File.get_or_404(file_id)

+ 1 - 1
pycs/frontend/endpoints/pipelines/PredictFile.py

@@ -25,7 +25,7 @@ class PredictFile(View):
         self.jobs = jobs
         self.pipelines = pipelines
 
-    def dispatch_request(self, file_id):
+    def dispatch_request(self, user: str, file_id):
         # find file
         file = File.get_or_404(file_id)
 

+ 1 - 1
pycs/frontend/endpoints/pipelines/PredictModel.py

@@ -32,7 +32,7 @@ class PredictModel(View):
         self.jobs = jobs
         self.pipelines = pipelines
 
-    def dispatch_request(self, project_id):
+    def dispatch_request(self, user: str, project_id):
         project = Project.get_or_404(project_id)
 
         # extract request data

+ 1 - 1
pycs/frontend/endpoints/projects/CreateProject.py

@@ -33,7 +33,7 @@ class CreateProject(View):
         self.nm = nm
         self.jobs = jobs
 
-    def dispatch_request(self):
+    def dispatch_request(self, user: str):
         # extract request data
         data = request.get_json(force=True)
 

+ 1 - 1
pycs/frontend/endpoints/projects/EditProjectDescription.py

@@ -19,7 +19,7 @@ class EditProjectDescription(View):
         self.nm = nm
 
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # extract request data
         data = request.get_json(force=True)
         description = data.get('description')

+ 1 - 1
pycs/frontend/endpoints/projects/EditProjectName.py

@@ -19,7 +19,7 @@ class EditProjectName(View):
         self.nm = nm
 
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # extract request data
         data = request.get_json(force=True)
         name = data.get('name')

+ 1 - 1
pycs/frontend/endpoints/projects/ExecuteExternalStorage.py

@@ -27,7 +27,7 @@ class ExecuteExternalStorage(View):
         self.nm = nm
         self.jobs = jobs
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # extract request data
         data = request.get_json(force=True)
 

+ 1 - 1
pycs/frontend/endpoints/projects/ExecuteLabelProvider.py

@@ -25,7 +25,7 @@ class ExecuteLabelProvider(View):
         self.nm = nm
         self.jobs = jobs
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         project = Project.get_or_404(project_id)
 
         # extract request data

+ 1 - 1
pycs/frontend/endpoints/projects/GetProjectModel.py

@@ -12,7 +12,7 @@ class GetProjectModel(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # find project
         project = Project.get_or_404(project_id)
 

+ 1 - 1
pycs/frontend/endpoints/projects/ListProjectCollections.py

@@ -13,7 +13,7 @@ class ListProjectCollections(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # find project
         project = Project.get_or_404(project_id)
 

+ 1 - 0
pycs/frontend/endpoints/projects/ListProjectFiles.py

@@ -14,6 +14,7 @@ class ListProjectFiles(View):
 
 
     def dispatch_request(self,
+                         user: str, 
                          project_id: int,
                          start: int = 0,
                          length: int = -1,

+ 1 - 1
pycs/frontend/endpoints/projects/RemoveProject.py

@@ -18,7 +18,7 @@ class RemoveProject(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # extract request data
         data = request.get_json(force=True)
 

+ 1 - 1
pycs/frontend/endpoints/results/ConfirmResult.py

@@ -16,7 +16,7 @@ class ConfirmResult(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, result_id: int):
+    def dispatch_request(self, user: str, result_id: int):
         # find result
         result = Result.get_or_404(result_id)
 

+ 1 - 1
pycs/frontend/endpoints/results/CreateResult.py

@@ -47,7 +47,7 @@ class CreateResult(View):
         return result_type, label, data
 
 
-    def dispatch_request(self, file_id: int):
+    def dispatch_request(self, user: str, file_id: int):
 
         file = File.get_or_404(file_id)
 

+ 1 - 1
pycs/frontend/endpoints/results/EditResultData.py

@@ -18,7 +18,7 @@ class EditResultData(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, result_id: int):
+    def dispatch_request(self, user: str, result_id: int):
         # find result
         result = Result.get_or_404(result_id)
 

+ 1 - 1
pycs/frontend/endpoints/results/EditResultLabel.py

@@ -18,7 +18,7 @@ class EditResultLabel(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, result_id: int):
+    def dispatch_request(self, user: str, result_id: int):
         # find result
         result = Result.get_or_404(result_id)
 

+ 1 - 1
pycs/frontend/endpoints/results/GetProjectResults.py

@@ -13,7 +13,7 @@ class GetProjectResults(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, project_id: int):
+    def dispatch_request(self, user: str, project_id: int):
         # get project from database
         project = Project.get_or_404(project_id)
 

+ 1 - 1
pycs/frontend/endpoints/results/GetResults.py

@@ -12,7 +12,7 @@ class GetResults(View):
     methods = ['GET']
 
 
-    def dispatch_request(self, file_id: int):
+    def dispatch_request(self, user: str, file_id: int):
         # get file from database
         file = File.get_or_404(file_id)
 

+ 1 - 1
pycs/frontend/endpoints/results/RemoveResult.py

@@ -18,7 +18,7 @@ class RemoveResult(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, result_id: int):
+    def dispatch_request(self, user: str, result_id: int):
         result = Result.get_or_404(result_id)
 
         # extract request data

+ 1 - 1
pycs/frontend/endpoints/results/ResetResults.py

@@ -18,7 +18,7 @@ class ResetResults(View):
         # pylint: disable=invalid-name
         self.nm = nm
 
-    def dispatch_request(self, file_id: int):
+    def dispatch_request(self, user: str, file_id: int):
         file = File.get_or_404(file_id)
 
         # extract request data