Bug 1667129 - Providing custom=false to products controller does not filter out custom products
Summary: Providing custom=false to products controller does not filter out custom prod...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Repositories
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Released
Assignee: John Mitsch
QA Contact: vijsingh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-17 14:25 UTC by John Mitsch
Modified: 2019-10-17 05:21 UTC (History)
2 users (show)

Fixed In Version: tfm-rubygem-katello-3.10.0.14-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:39:53 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:40:02 UTC
Foreman Issue Tracker 25180 None None None 2019-01-17 14:25:45 UTC

Description John Mitsch 2019-01-17 14:25:44 UTC
If I provide custom=false I still get custom products, see:  https://github.com/Katello/katello/blob/b7dc5d44d9d2af3b64a0c063a67f1e810be891cb/app/controllers/katello/api/v2/products_controller.rb#L50

Steps to Reproduce

* Access products API with custom=false (or any other value for that matter) - /katello/api/v2/organizations/1/products/?custom=false 
* Notice that only custom products are returned regardless of the value supplied to custom

Comment 1 John Mitsch 2019-01-17 14:25:46 UTC
Created from redmine issue https://projects.theforeman.org/issues/25180

Comment 2 John Mitsch 2019-01-17 14:25:48 UTC
Upstream bug assigned to jomitsch@redhat.com

Comment 3 John Mitsch 2019-01-17 14:27:50 UTC
I cloned this from redmine since this issue affects the dropdown in the RH repos page products filter. Users with a lot of custom products will find that filter frustrating to use since the custom products won't show on that page.

Comment 6 Bryan Kearney 2019-01-21 21:07:15 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25180 has been resolved.

Comment 9 John Mitsch 2019-01-30 13:52:52 UTC
The way it works is a little confusing at first, but this is how our booleans currently work in the Katello API:

There are two params, custom and redhat_only, they work with truthy values only

custom=true -> only return custom products
custom=false -> do nothing, return all products
redhat_only=true -> only return redhat products
redhat_only=false -> do nothing, return all products

To return only redhat products and no custom ones, use 'redhat_only=true'

This has been the pattern for booleans in our API, so we decided to continue with it and not introduce another pattern

Comment 11 vijsingh 2019-01-31 05:28:36 UTC
Verified:

@Satellite 6.5.0 Snap 13.0

steps/observation:

 There are two params, custom and redhat_only, they work with truthy values only

custom=true -> only return custom products
custom=false -> do nothing, return all products
redhat_only=true -> only return redhat products
redhat_only=false -> do nothing, return all products

Comment 14 errata-xmlrpc 2019-05-14 12:39:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222


Note You need to log in before you can comment on or make changes to this bug.