Bug 2089828

Summary: default Organization and location not set for AD users
Product: Red Hat Satellite Reporter: Jan Jansky <jjansky>
Component: AuthenticationAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.5CC: ahumbe, aruzicka, eresnick, lhellebr, mhulan, momran, pbadguja, pcreech, vsedmik, wpinheir
Target Milestone: 6.12.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: foreman-3.3.0.12-1,foreman-3.3.0.16-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 13:33:51 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:

Description Jan Jansky 2022-05-24 14:10:17 UTC
Description of problem:
During external authentication wrong organization and location is selected.

Version-Release number of selected component (if applicable):


How reproducible: aruzicka reproduced


Steps to Reproduce:
1. Create User with external authentication
2. Set Default organization and location for ext user
3. Login to WebUI

Actual results:
Default organization and location is not set correctly

Expected results:
Default organization and location will be set correctly

Additional info:


/var/log/foreman/production.log

2022-03-25T00:00:00 [I|app|ea079fdc] Started GET "/users/extlogin" for xxx.xxx.xxx.xxx at 2022-03-25 00:00:00 +0300
2022-03-25T00:00:00 [I|app|ea079fdc] Processing by UsersController#extlogin as HTML
2022-03-25T00:00:00 [I|app|ea079fdc] Authorized user ext_user(ext_user)
2022-03-25T00:00:00 [D|app|ea079fdc] Post-login processing for ext_user
2022-03-25T00:00:00 [D|tax|ea079fdc] Current location set to none         <<<<<
2022-03-25T00:00:00 [D|tax|ea079fdc] Current organization set to none     <<<<<
2022-03-25T00:00:00 [D|tax|ea079fdc] Current location set to none         <<<<<
2022-03-25T00:00:00 [D|tax|ea079fdc] Current organization set to none     <<<<<
2022-03-25T00:00:00 [I|app|ea079fdc] User 'ext_user' logged in from 'xxx.xxx.xxx.xxx'
2022-03-25T00:00:00 [I|app|ea079fdc] Redirected to https://satellite.example.com/
2022-03-25T00:00:00 [D|app|ea079fdc] Post-login processing for ext_user
2022-03-25T00:00:00 [I|app|ea079fdc] Completed 302 Found in 77ms (ActiveRecord: 25.8ms | Allocations: 23757)

DB

# su - postgres -c "psql foreman -c \"select id,login,mail,default_organization_id,default_location_id from users where mail = 'mail';\""
 id |        login        |          mail           | default_organization_id | default_location_id 
----+---------------------+-------------------------+-------------------------+---------------------
  6 | ext_user | mail         |                       1 |                   2
(1 row)

# su - postgres -c "psql foreman -c \"select * from taxonomies;\""
 id |  name   |     type     |         created_at         |         updated_at         |      ignore_types      | description |  label  | ancestry |  title  |   manifest_refreshed_at    | created_in_katello 
----+---------+--------------+----------------------------+----------------------------+------------------------+-------------+---------+----------+---------+----------------------------+--------------------
  2 |Location | Location     | 2022-02-13 00:00:00.000000 | 2022-02-13 00:00:00.000000 | ---                   +|             |         |          | Location|                            | f
    |         |              |                            |                            | - ProvisioningTemplate+|             |         |          |         |                            | 
    |         |              |                            |                            | - Hostgroup           +|             |         |          |         |                            | 
    |         |              |                            |                            |                        |             |         |          |         |                            | 
  1 | Org     | Organization | 2022-02-13 00:00:00.000000 | 2022-02-13 00:00:00.000000 |                        |             | Org     |          | Org     | 2022-02-13 00:00:00.000000 | t
(2 rows)

Comment 3 Adam Ruzicka 2022-09-13 07:53:06 UTC
*** Bug 2111445 has been marked as a duplicate of this bug. ***

Comment 4 Bryan Kearney 2022-09-20 20:04:04 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34949 has been resolved.

Comment 6 Vladimír Sedmík 2022-09-29 14:24:39 UTC
Tested in 6.12.0 snap 12:
The fix works well for external users with only 1 org/loc assigned. When the user is assigned to more orgs/locs, Any org/loc is selected on login, regardless the `Default on login` settings.

Comment 8 Vladimír Sedmík 2022-10-11 09:30:33 UTC
Verified in 6.12.0 snap 14 - now the AD external user with multiple orgs and locs assigned has correct taxonomy set on login according to the `Default on login` settings.

Comment 12 errata-xmlrpc 2022-11-16 13:33:51 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 (Important: Satellite 6.12 Release), 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-2022:8506