Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1199990

Summary: Can't update admin flag for users via API
Product: Red Hat Satellite Reporter: Tomas Strachota <tstrachota>
Component: ProvisioningAssignee: Tomas Strachota <tstrachota>
Status: CLOSED ERRATA QA Contact: jaudet
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, cwelton, jaudet, jmontleo
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/9678
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 05:29:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Strachota 2015-03-09 13:14:26 UTC
Anytime a json containing "admin" is sent via PUT on users the request fails with:
<pre>
undefined method `admin=' for nil:NilClass (NoMethodError)
</pre>

The relevant backtrace is:
<pre>
2015-03-09 09:57:27 [I] Started PUT "//api/users/13" for 127.0.0.1 at 2015-03-09 09:57:27 +0000
2015-03-09 09:57:27 [I] Processing by Api::V2::UsersController#update as JSON
2015-03-09 09:57:27 [I]   Parameters: {"user"=>{"admin"=>"false"}, "apiv"=>"v2", "id"=>"13"}
2015-03-09 09:57:27 [D]   ESC[1mESC[36mUser Load (0.2ms)ESC[0m  ESC[1mSELECT "users".* FROM "users" WHERE "users"."lower_login" = 'admin' LIMIT 1ESC[0m
2015-03-09 09:57:27 [D]   ESC[1mESC[35mAuthSource Load (0.1ms)ESC[0m  SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = 1 LIMIT 1
2015-03-09 09:57:27 [D]   ESC[1mESC[36mCACHE (0.0ms)ESC[0m  ESC[1mSELECT "users".* FROM "users" WHERE "users"."lower_login" = 'admin' LIMIT 1ESC[0m
2015-03-09 09:57:27 [D] Authenticated user Admin User against INTERNAL authentication source
2015-03-09 09:57:27 [D]   ESC[1mESC[35mUser Load (0.1ms)ESC[0m  SELECT "users".* FROM "users" WHERE "users"."lower_login" = 'foreman_admin' LIMIT 1
2015-03-09 09:57:27 [D] Setting current user thread-local variable to foreman_admin
2015-03-09 09:57:27 [D] Setting current user thread-local variable to nil
2015-03-09 09:57:27 [D]   ESC[1mESC[36mCACHE (0.0ms)ESC[0m  ESC[1mSELECT "users".* FROM "users" WHERE "users"."lower_login" = 'foreman_admin' LIMIT 1ESC[0m
2015-03-09 09:57:27 [D] Setting current user thread-local variable to foreman_admin
2015-03-09 09:57:27 [D]   ESC[1mESC[35m (0.0ms)ESC[0m  begin transaction
2015-03-09 09:57:27 [D]   ESC[1mESC[36m (0.2ms)ESC[0m  ESC[1mUPDATE "users" SET "last_login_on" = '2015-03-09 09:57:27.507351', "updated_at" = '2015-03-09 09:57:27.507910' WHERE "users"."id" = 1ESC[0m
2015-03-09 09:57:27 [D]   ESC[1mESC[35mRole Load (0.1ms)ESC[0m  SELECT "roles".* FROM "roles" WHERE "roles"."name" = 'Anonymous' LIMIT 1
2015-03-09 09:57:27 [D]   ESC[1mESC[36m (0.1ms)ESC[0m  ESC[1mSELECT "roles".id FROM "roles" INNER JOIN "user_roles" ON "roles"."id" = "user_roles"."role_id" WHERE "user_roles"."owner_id" = 1 AND "user_roles"."owner_type" = 'User'ESC[0m
2015-03-09 09:57:27 [D]   ESC[1mESC[35m (81.0ms)ESC[0m  commit transaction
2015-03-09 09:57:27 [D]   ESC[1mESC[36mCACHE (0.0ms)ESC[0m  ESC[1mSELECT "roles".* FROM "roles" WHERE "roles"."name" = 'Anonymous' LIMIT 1ESC[0m
2015-03-09 09:57:27 [D]   ESC[1mESC[35mRole Exists (0.1ms)ESC[0m  SELECT 1 AS one FROM "roles" INNER JOIN "user_roles" ON "roles"."id" = "user_roles"."role_id" WHERE "user_roles"."owner_id" = 1 AND "user_roles"."owner_type" = 'User' AND "r
oles"."id" = 8 LIMIT 1
2015-03-09 09:57:27 [D] Setting current user thread-local variable to nil
2015-03-09 09:57:27 [D] Setting current user thread-local variable to admin
2015-03-09 09:57:27 [D]   ESC[1mESC[36mAuthSourceHidden Load (0.1ms)ESC[0m  ESC[1mSELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."type" IN ('AuthSourceHidden')ESC[0m
2015-03-09 09:57:27 [D]   ESC[1mESC[35mUser Load (0.1ms)ESC[0m  SELECT "users".* FROM "users" WHERE "users"."lower_login" = 'admin' AND (users.auth_source_id <> 2) ORDER BY firstname LIMIT 1
2015-03-09 09:57:27 [I] Authorized user admin(Admin User)
2015-03-09 09:57:27 [D] Setting current user thread-local variable to admin
2015-03-09 09:57:27 [E] undefined method `admin=' for nil:NilClass (NoMethodError)
/root/foreman/app/controllers/concerns/foreman/controller/users_mixin.rb:46:in `update_admin_flag'
</pre>

Comment 1 Tomas Strachota 2015-03-09 13:14:27 UTC
Created from redmine issue http://projects.theforeman.org/issues/9678

Comment 3 Bryan Kearney 2015-03-09 14:05:44 UTC
Upstream bug assigned to tstrachota

Comment 4 Bryan Kearney 2015-03-10 10:05:41 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9678 has been closed
-------------
Anonymous
Applied in changeset commit:1b1b39861e485523b0cc0c6435fef30c38df7e07.

Comment 7 jaudet 2015-03-19 18:01:18 UTC
Verified against Satellite-6.1.0-RHEL-6-20150317.0 and Satellite-6.1.0-RHEL-7-20150317.0. An automated test for this bug will be added to QE's test suite shortly. See https://github.com/SatelliteQE/robottelo/pull/2004

Comment 8 Bryan Kearney 2015-08-11 13:31:04 UTC
This bug is slated to be released with Satellite 6.1.

Comment 9 errata-xmlrpc 2015-08-12 05:29:21 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-2015:1592