Bug #17244
closedError accessing dashboard when user has filtered access to hosts
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1232877
Description of problem:
When a user with filtered access to hosts attempts to access the dashboard he receives an Oops messages. The user has also been give view access to the dashboard.
Full call trace:
ActiveRecord::StatementInvalid
PGError: ERROR: missing FROM-clause entry for table "compute_resources" LINE 1: ...(2) AND "hosts"."type" IN ('Host::Managed') AND (("compute_r... ^ : SELECT COUNT FROM (SELECT "reports"."id" AS count_column FROM "reports" LEFT OUTER JOIN "hosts" ON "hosts"."id" = "reports"."host_id" AND "hosts"."type" IN ('Host::Managed') WHERE "reports"."host_id" IN (SELECT "hosts"."id" FROM "hosts" WHERE "hosts"."organization_id" IN (1) AND "hosts"."location_id" IN (2) AND "hosts"."type" IN ('Host::Managed') AND (("compute_resources"."name" = 'RHEV')) ORDER BY "hosts"."name" ASC NULLS FIRST ) AND (status <> 0) AND (("reports"."reported_at" >= '2015-06-09')) LIMIT 6) subquery_for_count
app/views/dashboard/_reports_widget.html.erb:3:in `_app_views_dashboard__reports_widget_html_erb___268700215681041418_127681020'
app/views/dashboard/index.html.erb:8:in `block in app_views_dashboard_index_html_erb_604474822609035711_127215680'
app/views/dashboard/index.html.erb:7:in `map'
app/views/dashboard/index.html.erb:7:in `_app_views_dashboard_index_html_erb__604474822609035711_127215680'
app/controllers/dashboard_controller.rb:6:in `index'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'