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

Added avatar support when passed through Keycloak #5998

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

farhatahmad
Copy link
Collaborator

@farhatahmad farhatahmad commented Feb 13, 2025

Added support for avatars that are passed through under the image key

For keycloak, there's some mapping changes that will need to be made to add support (atleast for Google, likely for others as well)

fixes #5987

user = create(:user, email: OmniAuth.config.mock_auth[:openid_connect][:info][:email])
user.avatar.attach(io: fixture_file_upload('default-avatar.png'), filename:, content_type: 'image/png')

expect(User.find_by(email: OmniAuth.config.mock_auth[:openid_connect][:info][:email]).avatar).not_to receive(:attach)
Copy link
Contributor

Choose a reason for hiding this comment

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

is :attach defined by us anywhere in greenlight?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its part of Active Storage - the rails extension that handles file attachements

https://guides.rubyonrails.org/active_storage_overview.html#has-one-attached


it 'does not re-attach the avatar if it hasnt changed' do
reg_method = instance_double(SettingGetter)
allow(SettingGetter).to receive(:new).with(setting_name: 'ResyncOnLogin', provider: 'greenlight').and_return(reg_method)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need the ReSynvOnLogin registration method in this case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By default, ResyncOnLogin in tests is set to false. This specific case tests that a user that has already logged in wont have the same image reattached.

So, by mocking it to true, it ensures that handle_avatar method actually runs again the second time the user logs in

@farhatahmad farhatahmad merged commit 9437946 into bigbluebutton:master Feb 19, 2025
4 checks passed
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.

openid user avatar sync not working
2 participants