Project

General

Profile

Bug #17364

User search using usergroup do not work

Added by Marek Hulán almost 5 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
Bugzilla link:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1395667

Description of problem:
When searching users using usergroup, Satellite returns following error:

2016-11-16 13:57:58 [app] [W] Action failed
 | ActiveRecord::StatementInvalid: PG::Error: ERROR:  column "member_type" does not exist
 | LINE 3: ...."id" = "cached_usergroup_members"."user_id"  AND member_typ...
 |                                                              ^
 | : SELECT  DISTINCT "users"."id", firstname AS alias_0 FROM "users" LEFT OUTER JOIN "cached_usergroup_members" ON "cached_usergroup_members"."user_id" = "users"."id" LEFT OUTER JOIN "usergroups" ON "usergroups"."id" = "cached_usergroup_members"."usergroup_id" LEFT OUTER JOIN "auth_sources" ON "auth_sources"."id" = "users"."auth_source_id" WHERE "users"."id" IN (4, 1, 2, 3) AND ("users"."auth_source_id" NOT IN (2)) AND (("users"."id" IN (SELECT "users"."id" FROM         "users" 
 |         INNER JOIN "cached_usergroup_members" 
 |         ON "users"."id" = "cached_usergroup_members"."user_id"  AND member_type = 'User'
 |         INNER JOIN "usergroups" 
 |         ON "cached_usergroup_members"."usergroup_id" = "usergroups"."id" 
 |  WHERE "usergroups"."name" = 'penguins' )))  ORDER BY firstname LIMIT 20 OFFSET 0
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/postgresql_adapter.rb:822:in `exec'

(full error message with ruby backtrace is enclosed to the BZ)

Version-Release number of selected component (if applicable):
Reproduced on:
  • Red Hat Satellite 6.2.3
  • Red Hat Satellite 6.2.4
  • Foreman nightly

How reproducible:
Always

Steps to Reproduce:
  1. Create a usergroup (Administer > User groups > New User Group)
  2. Add a user to the user group
  3. Sear for users belonging to the user group (Administer > Users > enter 'usergroup = <usergroupname>' in the search field and hit search)

Actual results:
The search will fail and Satellite reports above mentioned error.

Expected results:
All users belonging to the usergroup should be listed.


Related issues

Related to Foreman - Refactor #17574: Update to scoped_search 4.xClosed2016-12-05

Associated revisions

Revision ed67b8c9 (diff)
Added by Dominic Cleal almost 5 years ago

fixes #17574, #17364 - update scoped_search to 4.x

scoped_search's sort() now accepts a replacement for params which is
filtered in an overridden Foreman sort helper, permitting additional
parameters used in Foreman's index pages.

Replaces :in and :alias in search definitions with preferred keywords.

History

#1 Updated by Marek Hulán almost 5 years ago

  • Subject changed from User search using usergroup do not work to User search using usergroup do not work
  • Category changed from Users, Roles and Permissions to Search
  • Assignee set to Marek Hulán
  • Target version set to 1.4.4
  • Pull request https://github.com/wvanbergen/scoped_search/pull/151 added

I'll use this as a tracking issue for scoped_search PR fixing this issue - https://github.com/wvanbergen/scoped_search/pull/151

#2 Updated by Marek Hulán almost 5 years ago

  • Status changed from New to Ready For Testing

#3 Updated by Marek Hulán almost 5 years ago

  • Target version changed from 1.4.4 to 1.10.1

#4 Updated by Marek Hulán almost 5 years ago

waiting for new scoped search release, likely 0.3.1, we might then bump the dependency

#5 Updated by Dominic Cleal almost 5 years ago

#6 Updated by The Foreman Bot almost 5 years ago

  • Pull request https://github.com/theforeman/foreman/pull/4082 added

#7 Updated by Dominic Cleal almost 5 years ago

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

#8 Updated by Dominic Cleal almost 5 years ago

  • Legacy Backlogs Release (now unused) set to 209

Also available in: Atom PDF