diff --git a/lib/ldap/group.rb b/lib/ldap/group.rb index a1c5419f4..e92aa58ad 100644 --- a/lib/ldap/group.rb +++ b/lib/ldap/group.rb @@ -112,7 +112,7 @@ class Ldap # # @return [String, nil] The active or found filter or nil if none could be found. def filter - @filter ||= lookup_filter(['(objectClass=group)', '(objectClass=posixgroup)', '(objectClass=organization)']) + @filter ||= lookup_filter(['(objectClass=groupOfUniqueNames)', '(objectClass=group)', '(objectClass=posixgroup)', '(objectClass=organization)']) end # The active uid attribute of the instance. If none give on initialization an automatic lookup is performed. diff --git a/spec/sequencer/unit/import/common/model/reset_primary_key_sequence_spec.rb b/spec/lib/sequencer/unit/import/common/model/reset_primary_key_sequence_spec.rb similarity index 100% rename from spec/sequencer/unit/import/common/model/reset_primary_key_sequence_spec.rb rename to spec/lib/sequencer/unit/import/common/model/reset_primary_key_sequence_spec.rb diff --git a/spec/lib/sequencer/unit/import/ldap/user/mapping_spec.rb b/spec/lib/sequencer/unit/import/ldap/user/mapping_spec.rb new file mode 100644 index 000000000..8ec256d92 --- /dev/null +++ b/spec/lib/sequencer/unit/import/ldap/user/mapping_spec.rb @@ -0,0 +1,27 @@ +require 'rails_helper' + +RSpec.describe Sequencer::Unit::Import::Ldap::User::Mapping, sequencer: :unit do + + it 'ensures to unset attribute value if none is provided' do + + ldap_config = { + user_attributes: { + firstName: 'firstname', + lastName: 'lastname', + samaccountname: 'login', + } + } + + resource = { + samaccountname: 'Some41', + firstName: 'Some', + } + + provided = process( + ldap_config: ldap_config, + resource: resource, + ) + + expect(provided['lastname']).to be_nil + end +end