|
|
7e1b55 |
From a8d6257b2cf64c3dd2b1c5d7bcf81acc3b766853 Mon Sep 17 00:00:00 2001
|
|
|
7e1b55 |
From: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
7e1b55 |
Date: Mon, 5 Jul 2021 09:51:41 +0200
|
|
|
7e1b55 |
Subject: [PATCH] stageuser: add ipauserauthtypeclass when required
|
|
|
7e1b55 |
|
|
|
7e1b55 |
The command
|
|
|
7e1b55 |
ipa stageuser-add --user-auth-type=xxx
|
|
|
7e1b55 |
is currently failing because the objectclass ipauserauthtypeclass
|
|
|
7e1b55 |
is missing from the created entry.
|
|
|
7e1b55 |
|
|
|
7e1b55 |
There is code adding the missing objectclass in the
|
|
|
7e1b55 |
pre_common_callback method of user_add, and this code should
|
|
|
7e1b55 |
be common to user_add and stageuser_add. In order to avoid code
|
|
|
7e1b55 |
duplication, it makes more sense to move the existing code to
|
|
|
7e1b55 |
pre_common_callback of baseuser_add, that is called by both
|
|
|
7e1b55 |
classes.
|
|
|
7e1b55 |
|
|
|
7e1b55 |
Fixes: https://pagure.io/freeipa/issue/8909
|
|
|
7e1b55 |
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
|
|
|
7e1b55 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
7e1b55 |
---
|
|
|
7e1b55 |
ipaserver/plugins/baseuser.py | 3 +++
|
|
|
7e1b55 |
ipaserver/plugins/user.py | 4 ----
|
|
|
7e1b55 |
2 files changed, 3 insertions(+), 4 deletions(-)
|
|
|
7e1b55 |
|
|
|
7e1b55 |
diff --git a/ipaserver/plugins/baseuser.py b/ipaserver/plugins/baseuser.py
|
|
|
7e1b55 |
index ae16a978ab01f9c5c257e9cb5567c918a7fafdc5..6035228f19ef8acaf4992490d5512c126881816d 100644
|
|
|
7e1b55 |
--- a/ipaserver/plugins/baseuser.py
|
|
|
7e1b55 |
+++ b/ipaserver/plugins/baseuser.py
|
|
|
7e1b55 |
@@ -539,6 +539,9 @@ class baseuser_add(LDAPCreate):
|
|
|
7e1b55 |
if entry_attrs.get('ipatokenradiususername', None):
|
|
|
7e1b55 |
add_missing_object_class(ldap, u'ipatokenradiusproxyuser', dn,
|
|
|
7e1b55 |
entry_attrs, update=False)
|
|
|
7e1b55 |
+ if entry_attrs.get('ipauserauthtype', None):
|
|
|
7e1b55 |
+ add_missing_object_class(ldap, u'ipauserauthtypeclass', dn,
|
|
|
7e1b55 |
+ entry_attrs, update=False)
|
|
|
7e1b55 |
|
|
|
7e1b55 |
def post_common_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
|
|
7e1b55 |
assert isinstance(dn, DN)
|
|
|
7e1b55 |
diff --git a/ipaserver/plugins/user.py b/ipaserver/plugins/user.py
|
|
|
7e1b55 |
index 6f7facb5380ba56feab39b71cd265776f3ab57d8..e4ee572b236c288fd7dcf1d44c5adf1f836f63aa 100644
|
|
|
7e1b55 |
--- a/ipaserver/plugins/user.py
|
|
|
7e1b55 |
+++ b/ipaserver/plugins/user.py
|
|
|
7e1b55 |
@@ -617,10 +617,6 @@ class user_add(baseuser_add):
|
|
|
7e1b55 |
'ipauser' not in entry_attrs['objectclass']:
|
|
|
7e1b55 |
entry_attrs['objectclass'].append('ipauser')
|
|
|
7e1b55 |
|
|
|
7e1b55 |
- if 'ipauserauthtype' in entry_attrs and \
|
|
|
7e1b55 |
- 'ipauserauthtypeclass' not in entry_attrs['objectclass']:
|
|
|
7e1b55 |
- entry_attrs['objectclass'].append('ipauserauthtypeclass')
|
|
|
7e1b55 |
-
|
|
|
7e1b55 |
rcl = entry_attrs.get('ipatokenradiusconfiglink', None)
|
|
|
7e1b55 |
if rcl:
|
|
|
7e1b55 |
if 'ipatokenradiusproxyuser' not in entry_attrs['objectclass']:
|
|
|
7e1b55 |
--
|
|
|
7e1b55 |
2.26.3
|
|
|
7e1b55 |
|