As admin, I want that the 'group-add-member' IPA command would consider only the ID overrides from 'Default Trust View' so that there is no error when I try to add a User ID Override from the CLI to a given group.
[description of the issue] There is an internal error when trying to add a User ID Override to a specific User group. This is because the group-add-member <group-id> --idoverrideusers=<uid> command only should work in Default Trusts. But there is no indication or error that describes what it really going on on the backend.
group-add-member <group-id> --idoverrideusers=<uid>
ipa idoverrideuser_add my-idview bsanderson
ipa group-add-member my-group --idoverrideusers=bsanderson
The following error is shown:
ipa: ERROR: an internal error has occurred
The command should add user as User ID Override to a given user group whenever is possible (based on the DS/IPA requirements). Otherwise, display an error message describing what has failed and how to troubleshoot the error (ideally).
$ rpm -q freeipa-server freeipa-client ipa-server ipa-client 389-ds-base pki-ca krb5-server
From code review: group_add_member class is built on top of LDAPAddMember class which inherits from LDAPModMember and calls into get_member_dns() to collect LDAP DNs of the objects to be considered as members. LDAPModMember.get_member_dns() implements generic metadata reflection for any member-holding attribute that calls into <object type>.get_dn(object name) to retrieve a DN of the LDAP object represented by object name.
group_add_member
LDAPAddMember
LDAPModMember
get_member_dns()
LDAPModMember.get_member_dns()
<object type>.get_dn(object name)
object name
Original get_dn() implementation handle assumes only a single name is provided for the object and then a search is done against the primary key. In case of ID overrides, the structure is a bit more complex as ID overrides are localized within ID views. A code was added to baseidoverride.get_dn() to assume a Default Trust View in case ID view is missing or was passed as an empty string ('').
get_dn()
baseidoverride.get_dn()
Default Trust View
''
LDAPModMember.get_member_dns() does indeed pass no ID view reference to baseidoverride.get_dn() and that is interpreted as use of Default Trust View ID View. If an ID override was not found in the Default Trust View, it is considered unknown and will be returned as an error (not found).
So everything is working as designed here. Web UI should only allow to show ID overrides from Default Trust View when choosing ID overrides for adding as a group members.