Bug 1302725 - Bookmarks - 'public' attribute not mandatory
Bookmarks - 'public' attribute not mandatory
Status: VERIFIED
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API (Show other bugs)
Nightly
Unspecified Unspecified
unspecified Severity medium (vote)
: GA
: --
Assigned To: satellite6-bugs
Roman Plevka
http://projects.theforeman.org/issues...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-28 08:30 EST by Roman Plevka
Modified: 2017-08-15 16:20 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 13437 None None None 2016-04-22 11:05 EDT

  None (edit)
Description Roman Plevka 2016-01-28 08:30:39 EST
Description of problem:
Creation of a bookmark via API does not require 'public' attribute to be set, which results in 'public': null in the created entity.


Version-Release number of selected component (if applicable):
# rpm -qa katello
katello-2.5.0-3.nightly.el7.noarch
# rpm -qa foreman
foreman-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
# rpm -qa foreman-*
foreman-gce-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
foreman-libvirt-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
foreman-release-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
foreman-vmware-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
foreman-selinux-1.11.0-0.develop.201601041235git6234447.el7.noarch
foreman-ovirt-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
foreman-postgresql-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
foreman-compute-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
foreman-proxy-1.11.0-0.develop.201601211502git0a70eea.el7.noarch
foreman-release-scl-2-1.el7.x86_64
foreman-debug-1.11.0-0.develop.201601241936gitd600a50.el7.noarch
# rpm -qa *-katello
pulp-katello-0.4-3.el7.noarch
tfm-rubygem-katello-2.5.0-.201601221853git276ce3d1.nightly.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. send a POST request to <fqdn>/api/bookmarks specifying only a name, query and a controller attribute.

e.g.:

curl -ku admin:changeme -H Content-Type:application/json -d "{\"name\":\"foo\",\"query\":\"bar\", \"controller\":\"organizations\"}" 'https://<FQDN>/api/bookmarks'

Actual results:

{"name":"foo","controller":"organizations","query":"bar","public":null,"id":12,"owner_id":3,"owner_type":"User"}

Expected results:

public attribute should be set - so either an error should be returned forcing user to specify True/False. Or a default value should be assigned (False)
Comment 1 Roman Plevka 2016-01-28 08:31:21 EST
Created redmine issue http://projects.theforeman.org/issues/13437 from this bug
Comment 2 Bryan Kearney 2016-05-10 14:14:44 EDT
Moving to POST since upstream bug http://projects.theforeman.org/issues/13437 has been closed
Comment 4 Roman Plevka 2016-10-14 08:07:44 EDT
VERIFIED
sat6.3 snap3

public set to false if not set.

curl -ku admin:changeme -H Content-Type:application/json -d "{\"name\":\"foo\",\"query\":\"bar\", \"controller\":\"organizations\"}" "https://$(hostname)/api/bookmarks"

# curl -ku admin:changeme "https://$(hostname)/api/bookmarks?search=foo"
{
  "total": 15,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": "foo",
  "sort": {
    "by": null,
    "order": null
  },
  "results": [{"name":"foo","controller":"organizations","query":"bar","public":false,"id":15,"owner_id":3,"owner_type":"User"}]
}

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