Bug 2063168

Summary: [RFE] ipa user-undel <ipauser> doesnot restore the subid of the deleted user
Product: Red Hat Enterprise Linux 8 Reporter: Sudhir Menon <sumenon>
Component: ipaAssignee: Florence Blanc-Renaud <frenaud>
Status: NEW --- QA Contact: ipa-qe <ipa-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.6CC: pasik, rcritten, tscherf
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Story
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sudhir Menon 2022-03-11 12:25:19 UTC
Description of problem: ipa user-undel <ipauser> doesnot restore the subid of the deleted user.

Version-Release number of selected component (if applicable):
ipa-server-4.9.8-7.module+el8.6.0+14337+19b76db2.x86_64

How reproducible: Always

Steps to Reproduce:
1. Install IPA and enable the below option. 
   #ipa config-mod --user-default-subid=true
2. Now create an ipauser and ensure that UniqueID gets generated for the user.
3. Now delete the ipauser using --preserve option and is listed under 'Preserved Users' tab.
4. Now restore the user again and run the 'ipa user-find and ipa subid-find' command respectively

Actual results:
ipa user-find displays the user, however ipa subid-find doesn't list the UniqueId set for the user.

[root@server ~]# ipa user-add test102
Added user "test102"
Subordinate ids: cd29793d-c5de-4846-a0c2-f5fb495b3627

[root@server ~]# ipa user-del --preserve
User login: test102
Deleted user "test102"

[root@server ~]# ipa subid-find
0 subordinate ids matched

[root@server ~]# ipa user-undel 
User login: test102
Undeleted user account "test102"

[root@server ~]# ipa subid-find
Number of entries returned 0

[root@server ~]# ipa user-find
  User login: test102
  First name: test102
  Last name: s
  Home directory: /home/test102
  Login shell: /bin/sh
  Principal name: test102
  Principal alias: test102
  Email address: test102
  UID: 794800007
  GID: 794800007
  Account disabled: False
Number of entries returned 3

Expected results:
When a user is preserved, the user restore should include all the attributes of the user when it was created.

Additional info: