Bug 1412209 - Local user disappears from user-group with external group
Summary: Local user disappears from user-group with external group
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: LDAP
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: Unspecified
Assignee: Daniel Lobato Garcia
QA Contact: Sanket Jagtap
Depends On:
TreeView+ depends on / blocked
Reported: 2017-01-11 14:21 UTC by Jiri Vavra
Modified: 2020-02-14 18:26 UTC (History)
6 users (show)

Fixed In Version: foreman-
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:

Attachments (Terms of Use)
user group UI (38.83 KB, image/png)
2018-01-04 10:26 UTC, Sanket Jagtap
no flags Details

System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 21502 0 Normal Closed Local user disappears from user-group with external group 2020-03-11 11:19:30 UTC

Description Jiri Vavra 2017-01-11 14:21:30 UTC
Description of problem:
When attaching local user to user-group where is already set external group from LDAP, the user disappears when clicked on Submit button. When used hammer, the user disappears after
# foreman-rake ldap:refresh_usergroups
No error shown in WebUI/hammer/production.log

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

How reproducible:

Steps to Reproduce:
1. Set up LDAP authentication.
2. Create a user-group and in third tab "External groups" specify some external group. Submit.
3. Edit the user-group and add some local user.

Actual results:
In WebUI: local user is not saved. 
With hammer: user disappears later

# hammer user-group add-user --name 'Group Test' --user user_test
The user has been associated
# hammer user info --login user_test | grep -A1 'User groups'
User groups:
    Group Test
# sudo -u foreman /usr/sbin/foreman-rake ldap:refresh_usergroups
Successfully decrypted field for AuthSourceLdap LDAP-test
# hammer user info --login user_test | grep -A1 'User groups'
User groups:


Expected results:
- User can be added to group with External group
- OR local users are not available in list of users
- OR print error that it's not possible and write it to log

Additional info:
Workaround - create user-group with external group. Than create another "composite" user-group which will contain both local users and user-group with external group.

Comment 1 Marek Hulan 2017-01-11 16:14:35 UTC
The reason is likely that we don't check auth source of user when we refresh the user group. We should probably only manipulate users with auth source defined in external user group mapping.

Comment 2 Daniel Lobato Garcia 2017-01-12 22:41:29 UTC
It's expected - the moment you have external user groups in a user group, Satellite will only put users from the external user group there. 

A good workaround for this would be to display some message explaining this and block users from being added manually when you have external user groups. I would expect this for 6.3 though

Comment 4 Daniel Lobato Garcia 2017-10-30 09:50:35 UTC
Created redmine issue http://projects.theforeman.org/issues/21502 from this bug

Comment 5 pm-sat@redhat.com 2017-11-14 13:16:05 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21502 has been resolved.

Comment 6 Sanket Jagtap 2018-01-04 10:25:58 UTC
Build: Satellite 6.3.0 snap 30 

Created a Ldap Auth source 
Associated a user group with auth source 
Created a Internal user and associated it with created user group

hammer user list
hammer user info ---|-------|------------|------------------------------------|-------|---------------------|--------------
ID | LOGIN | NAME       | EMAIL                              | ADMIN | LAST LOGIN          | AUTHORIZED BY
3  | admin | Admin User | root@ | yes   | 2018/01/04 10:15:42 | Internal     
7  | Ohno  | Oh no      | Ohno@Ohno.com                      | no    | 2018/01/04 10:18:08 | Internal     
[root@qe-capsule-feature-rhel6 ~]# hammer user info --id 7
Id:                    7
Login:                 Ohno
Name:                  Oh no
Email:                 Ohno@Ohno.com
Admin:                 no
Last login:            2018/01/04 10:18:08
Authorized by:         Internal
Effective admin:       no
Locale:                default
Default organization:  
Default location:      

User groups:           
 1) Usergroup: idm
        Site manager
        Compliance viewer
        Compliance manager
Inherited User groups: 

    Default Location
    Default Organization
Created at:            2018/01/04 10:16:53
Updated at:            2018/01/04 10:16:53
hammer> user-group info --id 1
Id:                    1
Name:                  idm
Admin:                 no
User groups:           

Inherited User groups: 
 1) Usergroup: 
External user groups:  
    Site manager
    Compliance viewer
    Compliance manager
Created at:            2017/12/26 13:58:04
Updated at:            2017/12/26 13:58:04

Comment 7 Sanket Jagtap 2018-01-04 10:26:55 UTC
Created attachment 1376782 [details]
user group UI

Comment 8 pm-sat@redhat.com 2018-02-21 16:54:37 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-2018:0336

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