Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/user model upsert #2087

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def config_from_env(variable_name: str, *, default: str | bool | int | None = No

### open id
config_from_env("SPIFFWORKFLOW_BACKEND_AUTHENTICATION_DISABLED", default=False)
config_from_env("SPIFFWORKFLOW_BACKEND_CREATE_USERMODEL_WITHOUT_LOGIN", default=False)
config_from_env("SPIFFWORKFLOW_BACKEND_OPEN_ID_IS_AUTHORITY_FOR_USER_GROUPS", default=False)
# Tenant specific fields is a comma separated list of field names that we will be converted to list of strings
# and store in the user table's tenant_specific_field_n columns. You can have up to three items in this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ def _get_user_model_from_token(decoded_token: dict) -> UserModel | None:
.first()
)
if user_model is None:
if current_app.config["SPIFFWORKFLOW_BACKEND_CREATE_USERMODEL_WITHOUT_LOGIN"]:
user_model = AuthorizationService.create_user_from_sign_in(decoded_token)
AuthenticationService.set_user_has_logged_out()
raise ApiError(
error_code="invalid_user",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a cool feature, thanks. it looks like right after it creates the user model in this case, it will return an ApiError. is it possible for the request to succeed to make it more seamless?

Expand Down
Loading