ee/lib/ee/gitlab/auth/ldap/access.rb
# Add ssh keys that are in LDAP but not in GitLab
Add ssh keys that are in LDAP but not in GitLab
Add ssh keys that are in LDAP but not in GitLab
def add_new_ssh_keys
            keys = ldap_user.ssh_keys - user.keys.ldap.pluck(:key)
            keys.each do |key|
              ::Rails.logger.info "#{self.class.name}: adding LDAP SSH key #{key.inspect} to #{user.name} (#{user.id})"
              new_key = ::LDAPKey.new(title: "LDAP - #{ldap_config.sync_ssh_keys}", key: key)
              new_key.user = user
              unless new_key.save
                ::Rails.logger.error "#{self.class.name}: failed to add LDAP SSH key #{key.inspect} to #{user.name} (#{user.id})\n"\
                  "error messages: #{new_key.errors.messages}"
              end
            end
          end
def add_new_ssh_keys keys = ldap_user . ssh_keys - user . keys . ldap . pluck ( :key ) keys . each do | key | :: Rails . logger . info "#{self.class.name}: adding LDAP SSH key #{key.inspect} to #{user.name} (#{user.id})" new_key = :: LDAPKey . new ( title : "LDAP - #{ldap_config.sync_ssh_keys}" , key : key ) new_key . user = user unless new_key . save :: Rails . logger . error "#{self.class.name}: failed to add LDAP SSH key #{key.inspect} to #{user.name} (#{user.id})\n" "error messages: #{new_key.errors.messages}" end end end
Add ssh keys that are in LDAP but not in GitLab
Add ssh keys that are in LDAP but not in GitLab