-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Also log user when legacy sign in methods are used #5995
Conversation
WalkthroughThe changes in this pull request enhance the logging functionality within the Changes
Possibly related PRs
Suggested reviewers
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
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
app/controllers/auth/omniauth_callbacks_controller.rb (1)
254-254
: LGTM: Event logging for Smartschool legacy sign-in is well implemented.The event logging is correctly placed to capture Smartschool users signing in with legacy identifiers, and properly includes the user information for tracking purposes.
Consider extracting the event logging into a private method to reduce code duplication:
def find_identity_by_uid # ... existing code ... if provider.class.sym == :office365 && auth_email.present? # ... existing identity lookup code ... return nil if identity.nil? - Event.new(event_type: :other, message: 'Office365 user signed in with legacy identifier', user: identity.user).save! + log_legacy_signin!(identity, 'Office365') # Update the identifier to the new uid identity.update(identifier: auth_uid, identifier_based_on_email: false) elsif provider.class.sym == :smartschool && auth_username.present? # ... existing identity lookup code ... return nil if identity.nil? - Event.new(event_type: :other, message: 'Smartschool user signed in with legacy identifier', user: identity.user).save! + log_legacy_signin!(identity, 'Smartschool') # Update the identifier to the new uid identity.update(identifier: auth_uid, identifier_based_on_username: false) end identity end + private + + def log_legacy_signin!(identity, provider_name) + Event.new( + event_type: :other, + message: "#{provider_name} user signed in with legacy identifier", + user: identity.user + ).save! + end
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
app/controllers/auth/omniauth_callbacks_controller.rb
(2 hunks)
🔇 Additional comments (1)
app/controllers/auth/omniauth_callbacks_controller.rb (1)
238-238
: LGTM: Event logging for Office365 legacy sign-in is well implemented.
The event logging is correctly placed to capture Office365 users signing in with legacy identifiers, and properly includes the user information for tracking purposes.
This pull request adds the user to events.
In order to decide if we can get rid of the legacy sign in methods I wanted to see which accounts have been unused for more then 2 years and are picked up again. (Also to verify what the impact would be if we had given them a new account instead).
See https://dodona.be/en/events/?event_type=other