Skip to content

Commit

Permalink
Fixes #5101 - Fetching LdapSource for unknown users fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
fliebe92 committed Apr 23, 2024
1 parent 979314a commit c5266fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/ldap_source.rb
Expand Up @@ -10,6 +10,7 @@ class LdapSource < ApplicationModel
store :preferences

def self.by_user(user)
return if user.blank? || user.source.blank?
return if !%r{^Ldap::(\d+)$}.match?(user.source)

LdapSource.find(user.source.split('::')[1])
Expand Down
Expand Up @@ -46,5 +46,17 @@
expect(result).not_to include(action: :skipped)
end
end

context 'when user is empty' do
let(:user) { nil }

it 'does not skip' do
result = process({
instance: user,
})

expect(result).not_to include(action: :skipped)
end
end
end
end

0 comments on commit c5266fa

Please sign in to comment.