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

Fixes 500 when user info fetched from Keycloak #23

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

knikolla
Copy link
Collaborator

@knikolla knikolla commented Jan 11, 2024

When creating a users, we first attempt to fetch up to date information from Keycloak. However, when that succeeds, the API returns 500 because the dictionary returned contains an extra key.

TypeError: create_user() got an unexpected keyword argument 'source'.

This fixes the above error by passing only the required keys to create_user.

@joachimweyl
Copy link

Is this ready for Review?

Copy link
Contributor

@QuanMPhm QuanMPhm left a comment

Choose a reason for hiding this comment

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

The changes look fine. The only question seems to be whether it makes sense to check if user data obtained from Keycloak has the minimum required data, and whether we should sanitize them or not, similar to how register_users_from_csv.py sanitizes user data prior to user registration.

@knikolla
Copy link
Collaborator Author

The changes look fine. The only question seems to be whether it makes sense to check if user data obtained from Keycloak has the minimum required data, and whether we should sanitize them or not, similar to how register_users_from_csv.py sanitizes user data prior to user registration.

The only sanitization happening from the user registration script is if a RoleBinding on OpenShift needs to be created (that is done external to ColdFront and is applied directly to the OpenShift cluster). We don't do any form of sanitization for the communication to ColdFront itself.

When creating a users, we first attempt to fetch up to date
information from Keycloak. However, when that succeeds,
the API returns 500 because the dictionary returned contains
an extra key.

TypeError: create_user() got an unexpeTypeError: create_user() got
an unexpected keyword argument 'source'.

This fixes the above error by passing only the required keys to
create_user.
@jtriley jtriley self-requested a review February 8, 2024 19:38
@jtriley jtriley merged commit fced285 into nerc-project:main Feb 8, 2024
1 check passed
@knikolla knikolla deleted the fix/error_user_from_keycloak branch February 8, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants