Bug 1235012

Summary: PUT /api/v2/users/:id returns an incomplete set of attributes
Product: Red Hat Satellite Reporter: jaudet
Component: APIAssignee: alon <agoldboi>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bkearney, fsimonce, jcallaha, orabin, sthirugn, tbrisker
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 08:52:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1216236    
Bug Blocks:    
Attachments:
Description Flags
Output of foreman-debug from a Satellite 6.1.0 system running RHEL 7.1. none

Description jaudet 2015-06-23 18:29:35 UTC
Created attachment 1042473 [details]
Output of foreman-debug from a Satellite 6.1.0 system running RHEL 7.1.

Description of problem:
A user has at least the following attributes:

* admin
* auth_source
* default_location
* default_organization
* firstname
* id
* lastname
* location
* login
* mail
* organization
* password
* role

When one updates a user, the following attributes are returned:

* admin
* auth_source_id
* avatar_hash
* created_at
* default_location_id
* default_organization_id
* disabled
* firstname
* helptips_enabled
* id
* last_login_on
* lastname
* locale
* login
* lower_login
* mail
* mail_enabled
* page_size
* password_hash
* password_salt
* preferences
* remote_id
* updated_at

The following attributes are missing from the response:

* location
* organization
* role

Version-Release number of selected component (if applicable):
Satellite 6.1.0. Foreman-debug is attached.

How reproducible:
100%

Steps to Reproduce:
1. Issue HTTP PUT request to https://sat.example.com/api/v2/users/:id
2. Capture the response. Examine the JSON payload and discover that several
   attributes are not mentioned.
3. There is no step three.

Actual results:
See "Description of problem" section.

Expected results:
See "Description of problem" section.

Additional info:

Comment 1 RHEL Program Management 2015-06-23 18:42:35 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 alon 2015-07-14 12:20:16 UTC
Fixed in http://projects.theforeman.org/issues/10356

Comment 4 Tomer Brisker 2016-04-12 12:49:06 UTC
This has been resolved in current 6.2 snaps, moving to ON_QA for verification.

Comment 5 jcallaha 2016-04-12 19:08:09 UTC
Verified in Satellite 6.2 snap 7 compose 1. The expected attributes are now included.

{
  "firstname": "first",
  "lastname": "last",
  "mail": "RYBUcURZ",
  "admin": true,
  "auth_source_id": 1,
  "auth_source_name": "Internal",
  "timezone": null,
  "locale": null,
  "last_login_on": "2016-04-12 18:01:15 UTC",
  "created_at": "2016-04-12 18:00:16 UTC",
  "updated_at": "2016-04-12 19:06:06 UTC",
  "id": 5,
  "login": "19zz1o9Gcg",
  "default_location": null,
  "locations": [],
  "default_organization": null,
  "organizations": [],
  "auth_source_internal": {
    "id": 1,
    "type": "AuthSourceInternal",
    "name": "Internal"
  },
  "mail_notifications": [],
  "roles": [
    {
      "name": "Anonymous",
      "id": 21
    }
  ],
  "usergroups": []
}

Comment 7 errata-xmlrpc 2016-07-27 08:52:57 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/RHBA-2016:1500