|
@@ -17,6 +17,7 @@ from pycs.frontend.endpoints.ListLabelProviders import ListLabelProviders
|
|
|
from pycs.frontend.endpoints.ListModels import ListModels
|
|
|
from pycs.frontend.endpoints.ListProjects import ListProjects
|
|
|
from pycs.frontend.endpoints.additional.FolderInformation import FolderInformation
|
|
|
+from pycs.frontend.endpoints.additional.Authenticate import Authenticate
|
|
|
from pycs.frontend.endpoints.data.GetCroppedFile import GetCroppedFile
|
|
|
from pycs.frontend.endpoints.data.GetFile import GetFile
|
|
|
from pycs.frontend.endpoints.data.GetPreviousAndNextFile import GetPreviousAndNextFile
|
|
@@ -162,6 +163,13 @@ class WebServer:
|
|
|
def define_routes(self):
|
|
|
""" defines app routes """
|
|
|
|
|
|
+ # authentication
|
|
|
+ # additional
|
|
|
+ self.app.add_url_rule(
|
|
|
+ '/authenticate',
|
|
|
+ view_func=self.htpasswd.required( Authenticate.as_view('authenticate') )
|
|
|
+ )
|
|
|
+
|
|
|
# additional
|
|
|
self.app.add_url_rule(
|
|
|
'/folder',
|
|
@@ -203,19 +211,23 @@ class WebServer:
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/labels',
|
|
|
- view_func=self.htpasswd.required( CreateLabel.as_view('create_label', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( CreateLabel.as_view('create_label',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/labels/<int:label_id>/remove',
|
|
|
- view_func=self.htpasswd.required( RemoveLabel.as_view('remove_label', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( RemoveLabel.as_view('remove_label',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/labels/<int:label_id>/name',
|
|
|
- view_func=self.htpasswd.required( EditLabelName.as_view('edit_label_name', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( EditLabelName.as_view('edit_label_name',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/labels/<int:label_id>/parent',
|
|
|
- view_func=self.htpasswd.required( EditLabelParent.as_view('edit_label_parent', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( EditLabelParent.as_view('edit_label_parent',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
|
|
|
# collections
|
|
@@ -231,7 +243,8 @@ class WebServer:
|
|
|
# data
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/data',
|
|
|
- view_func=self.htpasswd.required( UploadFile.as_view('upload_file', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( UploadFile.as_view('upload_file',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/data',
|
|
@@ -243,7 +256,8 @@ class WebServer:
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/remove',
|
|
|
- view_func=self.htpasswd.required( RemoveFile.as_view('remove_file', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( RemoveFile.as_view('remove_file',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>',
|
|
@@ -259,7 +273,8 @@ class WebServer:
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/previous_next',
|
|
|
- view_func=self.htpasswd.required( GetPreviousAndNextFile.as_view('get_previous_and_next_file') )
|
|
|
+ view_func=self.htpasswd.required(
|
|
|
+ GetPreviousAndNextFile.as_view('get_previous_and_next_file') )
|
|
|
)
|
|
|
|
|
|
# results
|
|
@@ -273,28 +288,34 @@ class WebServer:
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/results',
|
|
|
- view_func=self.htpasswd.required( CreateResult.as_view('create_result', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( CreateResult.as_view('create_result',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/reset',
|
|
|
- view_func=self.htpasswd.required( ResetResults.as_view('reset_results', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( ResetResults.as_view('reset_results',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/results/<int:result_id>/remove',
|
|
|
- view_func=self.htpasswd.required( RemoveResult.as_view('remove_result', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( RemoveResult.as_view('remove_result',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/results/<int:result_id>/confirm',
|
|
|
- view_func=self.htpasswd.required( ConfirmResult.as_view('confirm_result', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( ConfirmResult.as_view('confirm_result',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
|
|
|
self.app.add_url_rule(
|
|
|
'/results/<int:result_id>/label',
|
|
|
- view_func=self.htpasswd.required( EditResultLabel.as_view('edit_result_label', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( EditResultLabel.as_view('edit_result_label',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/results/<int:result_id>/data',
|
|
|
- view_func=self.htpasswd.required( EditResultData.as_view('edit_result_data', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( EditResultData.as_view('edit_result_data',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
|
|
|
# projects
|
|
@@ -304,7 +325,8 @@ class WebServer:
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects',
|
|
|
- view_func=self.htpasswd.required( CreateProject.as_view('create_project', self.notifications, self.jobs) )
|
|
|
+ view_func=self.htpasswd.required( CreateProject.as_view('create_project',
|
|
|
+ self.notifications, self.jobs) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/label_provider',
|
|
@@ -313,41 +335,47 @@ class WebServer:
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/external_storage',
|
|
|
- view_func=self.htpasswd.required( ExecuteExternalStorage.as_view('execute_external_storage',
|
|
|
- self.notifications, self.jobs) )
|
|
|
+ view_func=self.htpasswd.required(
|
|
|
+ ExecuteExternalStorage.as_view('execute_external_storage',
|
|
|
+ self.notifications, self.jobs) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/remove',
|
|
|
- view_func=self.htpasswd.required( RemoveProject.as_view('remove_project', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( RemoveProject.as_view('remove_project',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/name',
|
|
|
- view_func=self.htpasswd.required( EditProjectName.as_view('edit_project_name', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required( EditProjectName.as_view('edit_project_name',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/description',
|
|
|
- view_func=self.htpasswd.required( EditProjectDescription.as_view('edit_project_description', self.notifications) )
|
|
|
+ view_func=self.htpasswd.required(
|
|
|
+ EditProjectDescription.as_view('edit_project_description',
|
|
|
+ self.notifications) )
|
|
|
)
|
|
|
|
|
|
# pipelines
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/pipelines/fit',
|
|
|
- view_func=self.htpasswd.required( FitModel.as_view('fit_model', self.jobs, self.pipelines) )
|
|
|
+ view_func=self.htpasswd.required( FitModel.as_view('fit_model', self.jobs,
|
|
|
+ self.pipelines) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/projects/<int:project_id>/pipelines/predict',
|
|
|
- view_func=self.htpasswd.required( PredictModel.as_view('predict_model', self.notifications, self.jobs,
|
|
|
- self.pipelines) )
|
|
|
+ view_func=self.htpasswd.required( PredictModel.as_view('predict_model',
|
|
|
+ self.notifications, self.jobs, self.pipelines) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/predict',
|
|
|
- view_func=self.htpasswd.required( PredictFile.as_view('predict_file', self.notifications,
|
|
|
- self.jobs, self.pipelines) )
|
|
|
+ view_func=self.htpasswd.required( PredictFile.as_view('predict_file',
|
|
|
+ self.notifications, self.jobs, self.pipelines) )
|
|
|
)
|
|
|
self.app.add_url_rule(
|
|
|
'/data/<int:file_id>/<int:bbox_id>/predict_bounding_box',
|
|
|
- view_func=self.htpasswd.required( PredictBoundingBox.as_view('predict_bounding_box', self.notifications,
|
|
|
- self.jobs, self.pipelines) )
|
|
|
+ view_func=self.htpasswd.required( PredictBoundingBox.as_view('predict_bounding_box',
|
|
|
+ self.notifications, self.jobs, self.pipelines) )
|
|
|
)
|
|
|
|
|
|
def run(self):
|