Bug #17244

Error accessing dashboard when user has filtered access to hosts

Added by Tomer Brisker over 1 year ago. Updated 9 days ago.

Status:Closed
Priority:Normal
Assignee:Tomer Brisker
Category:Dashboard
Target version:Katello 3.2.1
Difficulty: Team Backlog:
Triaged:Yes Fixed in Releases:
Bugzilla link:1232877 Found in Releases:
Pull request:https://github.com/Katello/katello/pull/6443

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'


Related issues

Related to Foreman - Bug #16704: Searching fails on dashboard Closed 09/27/2016
Related to Foreman - Bug #16044: Errors in individual dashboard widgets fail entire page Closed 08/10/2016

Associated revisions

Revision 0eddf0db
Added by Tomer Brisker over 1 year ago

Fixes #17244 - Errata widget does not break on filtered hosts

Due to an issue with how rails handles inner queries with complex
conditions, we need to manually generate the SQL for the errata widget
to correctly select the correct host ids in case there is a filter in
place on one of the related tables (for example, compute_resource).
This fix is similar to the fix for
http://projects.theforeman.org/issues/16704

History

#1 Updated by Tomer Brisker over 1 year ago

  • Related to Bug #16704: Searching fails on dashboard added

#2 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/6443 added

#3 Updated by Justin Sherrill over 1 year ago

  • Legacy Backlogs Release (now unused) set to 197

#4 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version set to 1.4.3

#5 Updated by Anonymous over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#6 Updated by Tomer Brisker over 1 year ago

  • Related to Bug #16044: Errors in individual dashboard widgets fail entire page added

Also available in: Atom PDF