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 - Can't update admin flag for users via API
Summary: Can't update admin flag for users via API
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Provisioning
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: Unspecified
Assignee: Tomas Strachota
QA Contact: jaudet
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-09 13:14 UTC by Tomas Strachota
Modified: 2017-02-23 20:21 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-12 05:29:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 9678 0 None None None 2016-04-22 15:46:28 UTC
Red Hat Product Errata RHSA-2015:1592 0 normal SHIPPED_LIVE Important: Red Hat Satellite 6.1.1 on RHEL 6 2015-08-12 09:04:35 UTC

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


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