-
Notifications
You must be signed in to change notification settings - Fork 43
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughWalkthroughThe changes introduce a new configuration option, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AuthService
participant Config
User->>AuthService: Request user model
AuthService->>Config: Check SPIFFWORKFLOW_BACKEND_CREATE_USERMODEL_WITHOUT_LOGIN
alt User model found
AuthService-->>User: Return user model
else User model not found
alt Feature enabled
AuthService->>AuthService: create_user_from_sign_in(decoded_token)
AuthService-->>User: Return new user model
else Feature disabled
AuthService-->>User: Return error (no user model)
end
end
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (2)
Additional comments not posted (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
@@ -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", |
There was a problem hiding this comment.
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?
When not using the frontend, users do not get created automatically, because there is no login. When simply using the backend, it would be desirable to allow user creation from the first time the token is used.
Summary by CodeRabbit
New Features
Bug Fixes