Figure out if users are using M365 login or local Zammad account

  • Used Zammad version: 6.3.1-1725942000.c81e7ad5.noble
  • Used Zammad installation type: Package
  • Operating system: Ubuntu 24.04
  • Browser + version: Firefox Latest

Expected behavior:

  • I need to identify whether users are logging in with a local Zammad account (imported from OTRS) or their Microsoft account. This is to determine if we can remove the login screen and keep only the OAuth login button.

I tried the following Rails command:

users_with_authorizations = User.left_outer_joins(:authorizations)
                                .where(active: true)  # Add condition to filter active users
                                .distinct

users_with_authorizations.each do |user|
  linked_accounts = user.authorizations.map(&:provider).join(', ')
  puts "User: #{user.email} | Linked Accounts: #{linked_accounts.presence || 'None'}"
end

However, this only checks for linked accounts, not whether users are actually logging in with their Microsoft account.

Might also be interesting to add the login type icon to the Sessions page but that is a feature request which might not be needed at this point in time.

Actual behavior:

  • No output showing the type of account users are using to log in.

Steps to reproduce the behavior:

  • Find a way to determine what type of account (local or Microsoft, or other OAuth) users are using to log into the system.

Any tip is greatly appreciated.

Best,
Skip

Hi @skip. Maybe user.source is what you are looking for.

Hi @fliebe92,

Thanks for the hint! While this shows whether a user was originally imported from OTRS, it doesn’t indicate whether the user is currently logging in with their OTRS username or via Microsoft OAuth.

For example, in my case, the system correctly identifies that my original user was imported from OTRS, but I’m actually logging into Zammad using my Microsoft account. Unfortunately, this isn’t clearly reflected anywhere, which makes it difficult to distinguish between users who are still using their OTRS login credentials versus those who have switched to Microsoft OAuth for authentication.