|
|
1f5726 |
From 06468b2f604c56b02231904072cb57412966a701 Mon Sep 17 00:00:00 2001
|
|
|
1f5726 |
From: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
1f5726 |
Date: Mon, 5 Jul 2021 09:51:41 +0200
|
|
|
1f5726 |
Subject: [PATCH] stageuser: add ipauserauthtypeclass when required
|
|
|
1f5726 |
|
|
|
1f5726 |
The command
|
|
|
1f5726 |
ipa stageuser-add --user-auth-type=xxx
|
|
|
1f5726 |
is currently failing because the objectclass ipauserauthtypeclass
|
|
|
1f5726 |
is missing from the created entry.
|
|
|
1f5726 |
|
|
|
1f5726 |
There is code adding the missing objectclass in the
|
|
|
1f5726 |
pre_common_callback method of user_add, and this code should
|
|
|
1f5726 |
be common to user_add and stageuser_add. In order to avoid code
|
|
|
1f5726 |
duplication, it makes more sense to move the existing code to
|
|
|
1f5726 |
pre_common_callback of baseuser_add, that is called by both
|
|
|
1f5726 |
classes.
|
|
|
1f5726 |
|
|
|
1f5726 |
Fixes: https://pagure.io/freeipa/issue/8909
|
|
|
1f5726 |
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
|
|
|
1f5726 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
1f5726 |
---
|
|
|
1f5726 |
ipaserver/plugins/baseuser.py | 3 +++
|
|
|
1f5726 |
ipaserver/plugins/user.py | 4 ----
|
|
|
1f5726 |
2 files changed, 3 insertions(+), 4 deletions(-)
|
|
|
1f5726 |
|
|
|
1f5726 |
diff --git a/ipaserver/plugins/baseuser.py b/ipaserver/plugins/baseuser.py
|
|
|
1f5726 |
index ae16a978a..6035228f1 100644
|
|
|
1f5726 |
--- a/ipaserver/plugins/baseuser.py
|
|
|
1f5726 |
+++ b/ipaserver/plugins/baseuser.py
|
|
|
1f5726 |
@@ -539,6 +539,9 @@ class baseuser_add(LDAPCreate):
|
|
|
1f5726 |
if entry_attrs.get('ipatokenradiususername', None):
|
|
|
1f5726 |
add_missing_object_class(ldap, u'ipatokenradiusproxyuser', dn,
|
|
|
1f5726 |
entry_attrs, update=False)
|
|
|
1f5726 |
+ if entry_attrs.get('ipauserauthtype', None):
|
|
|
1f5726 |
+ add_missing_object_class(ldap, u'ipauserauthtypeclass', dn,
|
|
|
1f5726 |
+ entry_attrs, update=False)
|
|
|
1f5726 |
|
|
|
1f5726 |
def post_common_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
|
|
1f5726 |
assert isinstance(dn, DN)
|
|
|
1f5726 |
diff --git a/ipaserver/plugins/user.py b/ipaserver/plugins/user.py
|
|
|
1f5726 |
index 6f7facb53..e4ee572b2 100644
|
|
|
1f5726 |
--- a/ipaserver/plugins/user.py
|
|
|
1f5726 |
+++ b/ipaserver/plugins/user.py
|
|
|
1f5726 |
@@ -617,10 +617,6 @@ class user_add(baseuser_add):
|
|
|
1f5726 |
'ipauser' not in entry_attrs['objectclass']:
|
|
|
1f5726 |
entry_attrs['objectclass'].append('ipauser')
|
|
|
1f5726 |
|
|
|
1f5726 |
- if 'ipauserauthtype' in entry_attrs and \
|
|
|
1f5726 |
- 'ipauserauthtypeclass' not in entry_attrs['objectclass']:
|
|
|
1f5726 |
- entry_attrs['objectclass'].append('ipauserauthtypeclass')
|
|
|
1f5726 |
-
|
|
|
1f5726 |
rcl = entry_attrs.get('ipatokenradiusconfiglink', None)
|
|
|
1f5726 |
if rcl:
|
|
|
1f5726 |
if 'ipatokenradiusproxyuser' not in entry_attrs['objectclass']:
|
|
|
1f5726 |
--
|
|
|
1f5726 |
2.31.1
|
|
|
1f5726 |
|
|
|
1f5726 |
From 4a5a0fe7d25209a41a2eadd159f7f4c771e5d7fc Mon Sep 17 00:00:00 2001
|
|
|
1f5726 |
From: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
1f5726 |
Date: Mon, 5 Jul 2021 10:22:31 +0200
|
|
|
1f5726 |
Subject: [PATCH] XMLRPC test: add a test for stageuser-add --user-auth-type
|
|
|
1f5726 |
|
|
|
1f5726 |
Related: https://pagure.io/freeipa/issue/8909
|
|
|
1f5726 |
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
|
|
|
1f5726 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
1f5726 |
---
|
|
|
1f5726 |
ipatests/test_xmlrpc/test_stageuser_plugin.py | 6 ++++++
|
|
|
1f5726 |
1 file changed, 6 insertions(+)
|
|
|
1f5726 |
|
|
|
1f5726 |
diff --git a/ipatests/test_xmlrpc/test_stageuser_plugin.py b/ipatests/test_xmlrpc/test_stageuser_plugin.py
|
|
|
1f5726 |
index 5586fc607..bc606b093 100644
|
|
|
1f5726 |
--- a/ipatests/test_xmlrpc/test_stageuser_plugin.py
|
|
|
1f5726 |
+++ b/ipatests/test_xmlrpc/test_stageuser_plugin.py
|
|
|
1f5726 |
@@ -343,6 +343,12 @@ class TestStagedUser(XMLRPC_test):
|
|
|
1f5726 |
result = command()
|
|
|
1f5726 |
assert result['count'] == 1
|
|
|
1f5726 |
|
|
|
1f5726 |
+ def test_create_withuserauthtype(self, stageduser):
|
|
|
1f5726 |
+ stageduser.ensure_missing()
|
|
|
1f5726 |
+ command = stageduser.make_create_command(
|
|
|
1f5726 |
+ options={u'ipauserauthtype': u'password'})
|
|
|
1f5726 |
+ command()
|
|
|
1f5726 |
+
|
|
|
1f5726 |
|
|
|
1f5726 |
@pytest.mark.tier1
|
|
|
1f5726 |
class TestCreateInvalidAttributes(XMLRPC_test):
|
|
|
1f5726 |
--
|
|
|
1f5726 |
2.31.1
|
|
|
1f5726 |
|