Merge branch 'main' of github.com:sartography/spiff-arena
This commit is contained in:
commit
9ca534042b
|
@ -922,7 +922,7 @@ def process_instance_list(
|
||||||
)
|
)
|
||||||
|
|
||||||
process_instances = (
|
process_instances = (
|
||||||
process_instance_query.distinct()
|
process_instance_query.group_by(ProcessInstanceModel.id)
|
||||||
.order_by(
|
.order_by(
|
||||||
ProcessInstanceModel.start_in_seconds.desc(), ProcessInstanceModel.id.desc() # type: ignore
|
ProcessInstanceModel.start_in_seconds.desc(), ProcessInstanceModel.id.desc() # type: ignore
|
||||||
)
|
)
|
||||||
|
|
|
@ -65,7 +65,7 @@ class SecretService:
|
||||||
def update_secret(
|
def update_secret(
|
||||||
key: str,
|
key: str,
|
||||||
value: str,
|
value: str,
|
||||||
user_id: int,
|
user_id: Optional[int] = None,
|
||||||
create_if_not_exists: Optional[bool] = False,
|
create_if_not_exists: Optional[bool] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Does this pass pre commit?"""
|
"""Does this pass pre commit?"""
|
||||||
|
@ -79,6 +79,12 @@ class SecretService:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
raise e
|
raise e
|
||||||
elif create_if_not_exists:
|
elif create_if_not_exists:
|
||||||
|
if user_id is None:
|
||||||
|
raise ApiError(
|
||||||
|
error_code="update_secret_error_no_user_id",
|
||||||
|
message=f"Cannot update secret with key: {key}. Missing user id.",
|
||||||
|
status_code=404,
|
||||||
|
)
|
||||||
SecretService.add_secret(key=key, value=value, user_id=user_id)
|
SecretService.add_secret(key=key, value=value, user_id=user_id)
|
||||||
else:
|
else:
|
||||||
raise ApiError(
|
raise ApiError(
|
||||||
|
|
|
@ -8,6 +8,7 @@ from flask import g
|
||||||
|
|
||||||
from spiffworkflow_backend.services.file_system_service import FileSystemService
|
from spiffworkflow_backend.services.file_system_service import FileSystemService
|
||||||
from spiffworkflow_backend.services.secret_service import SecretService
|
from spiffworkflow_backend.services.secret_service import SecretService
|
||||||
|
from spiffworkflow_backend.services.user_service import UserService
|
||||||
|
|
||||||
|
|
||||||
class ConnectorProxyError(Exception):
|
class ConnectorProxyError(Exception):
|
||||||
|
@ -65,7 +66,8 @@ class ServiceTaskDelegate:
|
||||||
|
|
||||||
secret_key = parsed_response["auth"]
|
secret_key = parsed_response["auth"]
|
||||||
refreshed_token_set = json.dumps(parsed_response["refreshed_token_set"])
|
refreshed_token_set = json.dumps(parsed_response["refreshed_token_set"])
|
||||||
SecretService().update_secret(secret_key, refreshed_token_set, g.user.id)
|
user_id = g.user.id if UserService.has_user() else None
|
||||||
|
SecretService().update_secret(secret_key, refreshed_token_set, user_id)
|
||||||
|
|
||||||
return json.dumps(parsed_response["api_response"])
|
return json.dumps(parsed_response["api_response"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue