Project

General

Profile

Actions

Bug #26414

open

Api error when querying LDAP users

Added by Ondřej Pražák about 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Description of problem:
We get RuntimeError when we try to list LDAP users.

Steps to reproduce:

hammer user list --auth-source-ldap-id 3

2019-03-20T09:22:04 [I|app|9efa0498] Started GET "/api/auth_source_ldaps/3/users?page=1&per_page=1000" for ::1 at 2019-03-20 09:22:04 +0000
2019-03-20T09:22:04 [I|app|9efa0498] Processing by Api::V2::UsersController#index as JSON
2019-03-20T09:22:04 [I|app|9efa0498]   Parameters: {"page"=>"1", "per_page"=>"1000", "apiv"=>"v2", "auth_source_ldap_id"=>"3", "user"=>{}}
2019-03-20T09:22:04 [D|app|9efa0498] Authenticated user admin against INTERNAL authentication source
2019-03-20T09:22:04 [D|app|9efa0498] Current user set to foreman_admin (admin)
2019-03-20T09:22:04 [I|app|9efa0498] Authorized user admin(Admin User)
2019-03-20T09:22:04 [I|app|9efa0498] Current user set to admin (admin)
2019-03-20T09:22:04 [D|app|9efa0498] Current location set to none
2019-03-20T09:22:04 [D|app|9efa0498] Current organization set to none
2019-03-20T09:22:04 [D|app|9efa0498] Current location set to none
2019-03-20T09:22:04 [D|app|9efa0498] Current organization set to none
2019-03-20T09:22:04 [W|app|9efa0498] DEPRECATION WARNING: Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "CASE WHEN \"auth_sources\".\"name\" = '3' THEN 1 ELSE 0 END". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql(). (called from prioritize_friendly_name_records at /home/vagrant/projects/foreman/app/controllers/api/base_controller.rb:410)
2019-03-20T09:22:04 [W|app|9efa0498] DEPRECATION WARNING: Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "CASE WHEN \"auth_sources\".\"name\" = '3' THEN 1 ELSE 0 END". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql(). (called from prioritize_friendly_name_records at /home/vagrant/projects/foreman/app/controllers/api/base_controller.rb:410)
2019-03-20T09:22:04 [W|app|9efa0498] Action failed
 | RuntimeError: Association not found for auth_source_ldap
 | /home/vagrant/projects/foreman/app/controllers/api/base_controller.rb:75:in `parent_scope'
 | /home/vagrant/projects/foreman/app/controllers/api/base_controller.rb:61:in `resource_scope'
 | /home/vagrant/projects/foreman/app/controllers/concerns/foreman/controller/users_mixin.rb:10:in `resource_scope'
 | /home/vagrant/projects/foreman/app/controllers/api/base_controller.rb:100:in `resource_scope_for_index'
 | /home/vagrant/projects/foreman/app/controllers/api/v2/users_controller.rb:31:in `index'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
 | /home/vagrant/projects/foreman/app/controllers/api/v2/base_controller.rb:163:in `disable_json_root'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 | /home/vagrant/projects/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 | /home/vagrant/projects/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 | /home/vagrant/projects/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/audited-4.8.0/lib/audited/sweeper.rb:14:in `around'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/audited-4.8.0/lib/audited/sweeper.rb:14:in `around'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/routing/mapper.rb:48:in `serve'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/apipie-rails-0.5.15/lib/apipie/static_dispatcher.rb:66:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/bullet-5.9.0/lib/bullet/rack.rb:15:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/apipie-rails-0.5.15/lib/apipie/extractor/recorder.rb:137:in `call'
 | /home/vagrant/projects/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/apipie-rails-0.5.15/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 | /home/vagrant/projects/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-openid-1.4.2/lib/rack/openid.rb:98:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/tempfile_reaper.rb:15:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/etag.rb:25:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/conditional_get.rb:25:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/head.rb:12:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 | /home/vagrant/projects/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:232:in `context'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:226:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activerecord-5.2.1/lib/active_record/migration.rb:559:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 | /home/vagrant/projects/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
 | /home/vagrant/projects/katello/lib/katello/prevent_json_parsing.rb:12:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/secure_headers-6.0.0/lib/secure_headers/middleware.rb:13:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/urlmap.rb:68:in `block in call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `each'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
 | /home/vagrant/.rvm/gems/ruby-2.3.4/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
Actions #1

Updated by Anonymous almost 5 years ago

  • Related to Refactor #23300: Do not use string interpolation when composing SQL queries. added
Actions #2

Updated by Anonymous almost 5 years ago

Actions #3

Updated by Anonymous over 4 years ago

Actions #4

Updated by Anonymous over 4 years ago

  • Related to deleted (Refactor #23300: Do not use string interpolation when composing SQL queries.)
Actions

Also available in: Atom PDF