new service tasks controller
This commit is contained in:
parent
3695ab7ded
commit
ff18aa77bc
|
@ -1476,7 +1476,7 @@ paths:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Service Tasks
|
- Service Tasks
|
||||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.service_task_list
|
operationId: spiffworkflow_backend.routes.service_tasks_controller.service_task_list
|
||||||
summary: Gets all available service task connectors
|
summary: Gets all available service task connectors
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
@ -1490,7 +1490,7 @@ paths:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Authentications
|
- Authentications
|
||||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.authentication_list
|
operationId: spiffworkflow_backend.routes.service_tasks_controller.authentication_list
|
||||||
summary: Gets all available authentications from connector proxy
|
summary: Gets all available authentications from connector proxy
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
@ -1529,7 +1529,7 @@ paths:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Authentications
|
- Authentications
|
||||||
operationId: spiffworkflow_backend.routes.process_api_blueprint.authentication_callback
|
operationId: spiffworkflow_backend.routes.service_tasks_controller.authentication_callback
|
||||||
summary: Callback to backend
|
summary: Callback to backend
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
"""APIs for dealing with process groups, process models, and process instances."""
|
"""APIs for dealing with process groups, process models, and process instances."""
|
||||||
import json
|
import json
|
||||||
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
|
||||||
import flask.wrappers
|
|
||||||
|
|
||||||
|
import flask.wrappers
|
||||||
from flask.wrappers import Response
|
from flask.wrappers import Response
|
||||||
|
|
||||||
|
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
||||||
|
|
||||||
|
|
||||||
def status() -> flask.wrappers.Response:
|
def status() -> flask.wrappers.Response:
|
||||||
"""Status."""
|
"""Status."""
|
||||||
|
|
|
@ -4,13 +4,11 @@ from typing import Any
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
import flask.wrappers
|
import flask.wrappers
|
||||||
import werkzeug
|
|
||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from flask import g
|
from flask import g
|
||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
from flask import make_response
|
from flask import make_response
|
||||||
from flask import redirect
|
|
||||||
from flask import request
|
from flask import request
|
||||||
from flask.wrappers import Response
|
from flask.wrappers import Response
|
||||||
from flask_bpmn.api.api_error import ApiError
|
from flask_bpmn.api.api_error import ApiError
|
||||||
|
@ -32,15 +30,12 @@ from spiffworkflow_backend.models.process_instance import (
|
||||||
from spiffworkflow_backend.models.process_model import ProcessModelInfo
|
from spiffworkflow_backend.models.process_model import ProcessModelInfo
|
||||||
from spiffworkflow_backend.models.spec_reference import SpecReferenceCache
|
from spiffworkflow_backend.models.spec_reference import SpecReferenceCache
|
||||||
from spiffworkflow_backend.models.spec_reference import SpecReferenceSchema
|
from spiffworkflow_backend.models.spec_reference import SpecReferenceSchema
|
||||||
from spiffworkflow_backend.routes.user import verify_token
|
|
||||||
from spiffworkflow_backend.services.authorization_service import AuthorizationService
|
from spiffworkflow_backend.services.authorization_service import AuthorizationService
|
||||||
from spiffworkflow_backend.services.git_service import GitService
|
from spiffworkflow_backend.services.git_service import GitService
|
||||||
from spiffworkflow_backend.services.process_instance_processor import (
|
from spiffworkflow_backend.services.process_instance_processor import (
|
||||||
ProcessInstanceProcessor,
|
ProcessInstanceProcessor,
|
||||||
)
|
)
|
||||||
from spiffworkflow_backend.services.process_model_service import ProcessModelService
|
from spiffworkflow_backend.services.process_model_service import ProcessModelService
|
||||||
from spiffworkflow_backend.services.secret_service import SecretService
|
|
||||||
from spiffworkflow_backend.services.service_task_service import ServiceTaskService
|
|
||||||
|
|
||||||
|
|
||||||
process_api_blueprint = Blueprint("process_api", __name__)
|
process_api_blueprint = Blueprint("process_api", __name__)
|
||||||
|
@ -96,41 +91,6 @@ def process_list() -> Any:
|
||||||
return SpecReferenceSchema(many=True).dump(references)
|
return SpecReferenceSchema(many=True).dump(references)
|
||||||
|
|
||||||
|
|
||||||
def service_task_list() -> flask.wrappers.Response:
|
|
||||||
"""Service_task_list."""
|
|
||||||
available_connectors = ServiceTaskService.available_connectors()
|
|
||||||
return Response(
|
|
||||||
json.dumps(available_connectors), status=200, mimetype="application/json"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def authentication_list() -> flask.wrappers.Response:
|
|
||||||
"""Authentication_list."""
|
|
||||||
available_authentications = ServiceTaskService.authentication_list()
|
|
||||||
response_json = {
|
|
||||||
"results": available_authentications,
|
|
||||||
"connector_proxy_base_url": current_app.config["CONNECTOR_PROXY_URL"],
|
|
||||||
"redirect_url": f"{current_app.config['SPIFFWORKFLOW_BACKEND_URL']}/v1.0/authentication_callback",
|
|
||||||
}
|
|
||||||
|
|
||||||
return Response(json.dumps(response_json), status=200, mimetype="application/json")
|
|
||||||
|
|
||||||
|
|
||||||
def authentication_callback(
|
|
||||||
service: str,
|
|
||||||
auth_method: str,
|
|
||||||
) -> werkzeug.wrappers.Response:
|
|
||||||
"""Authentication_callback."""
|
|
||||||
verify_token(request.args.get("token"), force_run=True)
|
|
||||||
response = request.args["response"]
|
|
||||||
SecretService().update_secret(
|
|
||||||
f"{service}/{auth_method}", response, g.user.id, create_if_not_exists=True
|
|
||||||
)
|
|
||||||
return redirect(
|
|
||||||
f"{current_app.config['SPIFFWORKFLOW_FRONTEND_URL']}/admin/configuration"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def process_data_show(
|
def process_data_show(
|
||||||
process_instance_id: int,
|
process_instance_id: int,
|
||||||
process_data_identifier: str,
|
process_data_identifier: str,
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
"""APIs for dealing with process groups, process models, and process instances."""
|
||||||
|
import json
|
||||||
|
from spiffworkflow_backend.routes.user import verify_token
|
||||||
|
from flask import redirect
|
||||||
|
from flask import request
|
||||||
|
import werkzeug
|
||||||
|
from flask import current_app
|
||||||
|
import flask.wrappers
|
||||||
|
from spiffworkflow_backend.services.service_task_service import ServiceTaskService
|
||||||
|
|
||||||
|
from flask import g
|
||||||
|
from flask.wrappers import Response
|
||||||
|
|
||||||
|
from spiffworkflow_backend.services.secret_service import SecretService
|
||||||
|
|
||||||
|
|
||||||
|
def service_task_list() -> flask.wrappers.Response:
|
||||||
|
"""Service_task_list."""
|
||||||
|
available_connectors = ServiceTaskService.available_connectors()
|
||||||
|
return Response(
|
||||||
|
json.dumps(available_connectors), status=200, mimetype="application/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def authentication_list() -> flask.wrappers.Response:
|
||||||
|
"""Authentication_list."""
|
||||||
|
available_authentications = ServiceTaskService.authentication_list()
|
||||||
|
response_json = {
|
||||||
|
"results": available_authentications,
|
||||||
|
"connector_proxy_base_url": current_app.config["CONNECTOR_PROXY_URL"],
|
||||||
|
"redirect_url": f"{current_app.config['SPIFFWORKFLOW_BACKEND_URL']}/v1.0/authentication_callback",
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response(json.dumps(response_json), status=200, mimetype="application/json")
|
||||||
|
|
||||||
|
|
||||||
|
def authentication_callback(
|
||||||
|
service: str,
|
||||||
|
auth_method: str,
|
||||||
|
) -> werkzeug.wrappers.Response:
|
||||||
|
"""Authentication_callback."""
|
||||||
|
verify_token(request.args.get("token"), force_run=True)
|
||||||
|
response = request.args["response"]
|
||||||
|
SecretService().update_secret(
|
||||||
|
f"{service}/{auth_method}", response, g.user.id, create_if_not_exists=True
|
||||||
|
)
|
||||||
|
return redirect(
|
||||||
|
f"{current_app.config['SPIFFWORKFLOW_FRONTEND_URL']}/admin/configuration"
|
||||||
|
)
|
Loading…
Reference in New Issue