mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Allow RDN changes for users, groups, rolegroups and taskgroups.
To do a change right now you have to perform a setattr like: ipa user-mod --setattr uid=newuser olduser The RDN change is performed before the rest of the mods. If the RDN change is the only change done then the EmptyModlist that update_entry() throws is ignored. ticket 323
This commit is contained in:
committed by
Simo Sorce
parent
93290c8a72
commit
70a57924c8
@@ -27,6 +27,7 @@ from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
|
||||
|
||||
group1 = u'testgroup1'
|
||||
group2 = u'testgroup2'
|
||||
renamedgroup1 = u'testgroup'
|
||||
user1 = u'tuser1'
|
||||
|
||||
invalidgroup1=u'+tgroup1'
|
||||
@@ -65,6 +66,13 @@ class test_group(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Try to rename non-existent %r' % group1,
|
||||
command=('group_mod', [group1], dict(setattr=u'cn=%s' % renamedgroup1)),
|
||||
expected=errors.NotFound(reason='no such entry'),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Create non-POSIX %r' % group1,
|
||||
command=(
|
||||
@@ -327,6 +335,8 @@ class test_group(Declarative):
|
||||
'gidnumber': [fuzzy_digits],
|
||||
'cn': [u'admins'],
|
||||
'description': [u'Account administrators group'],
|
||||
'memberof_rolegroup': [u'replicaadmin'],
|
||||
'memberof_taskgroup': [u'managereplica', u'deletereplica'],
|
||||
},
|
||||
{
|
||||
'dn': u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||
@@ -453,6 +463,36 @@ class test_group(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r' % group1,
|
||||
command=('group_mod', [group1], dict(setattr=u'cn=%s' % renamedgroup1)),
|
||||
expected=dict(
|
||||
value=group1,
|
||||
result=dict(
|
||||
cn=[renamedgroup1],
|
||||
description=[u'New desc 1'],
|
||||
gidnumber=[fuzzy_digits],
|
||||
),
|
||||
summary=u'Modified group "%s"' % group1
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r back' % renamedgroup1,
|
||||
command=('group_mod', [renamedgroup1], dict(setattr=u'cn=%s' % group1)),
|
||||
expected=dict(
|
||||
value=renamedgroup1,
|
||||
result=dict(
|
||||
cn=[group1],
|
||||
description=[u'New desc 1'],
|
||||
gidnumber=[fuzzy_digits],
|
||||
),
|
||||
summary=u'Modified group "%s"' % renamedgroup1
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
|
||||
################
|
||||
# delete group1:
|
||||
|
||||
@@ -233,6 +233,13 @@ class test_host(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Try to rename %r' % fqdn1,
|
||||
command=('host_mod', [fqdn1], dict(setattr=u'fqdn=changed')),
|
||||
expected=errors.NotAllowedOnRDN()
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Delete %r' % fqdn1,
|
||||
command=('host_del', [fqdn1], {}),
|
||||
|
||||
@@ -31,6 +31,7 @@ rolegroup1 = u'test-rolegroup-1'
|
||||
rolegroup1_dn = u'cn=%s,cn=rolegroups,cn=accounts,%s' % (
|
||||
rolegroup1, api.env.basedn
|
||||
)
|
||||
renamedrolegroup1 = u'test-rolegroup'
|
||||
|
||||
rolegroup2 = u'test-rolegroup-2'
|
||||
rolegroup2_dn = u'cn=%s,cn=rolegroups,cn=accounts,%s' % (
|
||||
@@ -72,6 +73,13 @@ class test_rolegroup(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Try to rename non-existent %r' % rolegroup1,
|
||||
command=('rolegroup_del', [rolegroup1], dict(setattr=u'cn=%s' % renamedrolegroup1)),
|
||||
expected=errors.NotFound(reason='no such entry'),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Search for non-existent %r' % rolegroup1,
|
||||
command=('rolegroup_find', [rolegroup1], {}),
|
||||
@@ -356,6 +364,34 @@ class test_rolegroup(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r' % rolegroup1,
|
||||
command=('rolegroup_mod', [rolegroup1], dict(setattr=u'cn=%s' % renamedrolegroup1)),
|
||||
expected=dict(
|
||||
value=rolegroup1,
|
||||
result=dict(
|
||||
cn=[renamedrolegroup1],
|
||||
description=[u'New desc 1'],
|
||||
),
|
||||
summary=u'Modified rolegroup "%s"' % rolegroup1
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r back' % renamedrolegroup1,
|
||||
command=('rolegroup_mod', [renamedrolegroup1], dict(setattr=u'cn=%s' % rolegroup1)),
|
||||
expected=dict(
|
||||
value=renamedrolegroup1,
|
||||
result=dict(
|
||||
cn=[rolegroup1],
|
||||
description=[u'New desc 1'],
|
||||
),
|
||||
summary=u'Modified rolegroup "%s"' % renamedrolegroup1
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Delete %r' % rolegroup1,
|
||||
command=('rolegroup_del', [rolegroup1], {}),
|
||||
|
||||
@@ -32,6 +32,7 @@ taskgroup1 = u'test-taskgroup-1'
|
||||
taskgroup1_dn = u'cn=%s,cn=taskgroups,cn=accounts,%s' % (
|
||||
taskgroup1, api.env.basedn
|
||||
)
|
||||
renamedtaskgroup1 = u'test-taskgroup1'
|
||||
|
||||
taskgroup2 = u'test-taskgroup-2'
|
||||
taskgroup2_dn = u'cn=%s,cn=taskgroups,cn=accounts,%s' % (
|
||||
@@ -79,6 +80,13 @@ class test_taskgroup(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Try to rename non-existent %r' % taskgroup1,
|
||||
command=('taskgroup_del', [taskgroup1], dict(setattr=u'cn=%s' % renamedtaskgroup1)),
|
||||
expected=errors.NotFound(reason='no such entry'),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Search for non-existent %r' % taskgroup1,
|
||||
command=('taskgroup_find', [taskgroup1], {}),
|
||||
@@ -361,6 +369,36 @@ class test_taskgroup(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r' % taskgroup1,
|
||||
command=('taskgroup_mod', [taskgroup1], dict(setattr=u'cn=%s' % renamedtaskgroup1)),
|
||||
expected=dict(
|
||||
value=taskgroup1,
|
||||
result=dict(
|
||||
cn=[renamedtaskgroup1],
|
||||
description=[u'New desc 1'],
|
||||
member_rolegroup=[u'test-rolegroup-1'],
|
||||
),
|
||||
summary=u'Modified taskgroup "%s"' % taskgroup1
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r back' % renamedtaskgroup1,
|
||||
command=('taskgroup_mod', [renamedtaskgroup1], dict(setattr=u'cn=%s' % taskgroup1)),
|
||||
expected=dict(
|
||||
value=renamedtaskgroup1,
|
||||
result=dict(
|
||||
cn=[taskgroup1],
|
||||
description=[u'New desc 1'],
|
||||
member_rolegroup=[u'test-rolegroup-1'],
|
||||
),
|
||||
summary=u'Modified taskgroup "%s"' % renamedtaskgroup1
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Delete %r' % taskgroup1,
|
||||
command=('taskgroup_del', [taskgroup1], {}),
|
||||
|
||||
@@ -31,6 +31,7 @@ from xmlrpc_test import Declarative, fuzzy_digits, fuzzy_uuid
|
||||
user_memberof = (u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,)
|
||||
user1=u'tuser1'
|
||||
user2=u'tuser2'
|
||||
renameduser1=u'tuser'
|
||||
|
||||
invaliduser1=u'+tuser1'
|
||||
invaliduser2=u'tuser1234567890123456789012345678901234567890'
|
||||
@@ -65,6 +66,13 @@ class test_user(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Try to rename non-existent %r' % user1,
|
||||
command=('user_mod', [user1], dict(setattr=u'uid=tuser')),
|
||||
expected=errors.NotFound(reason='no such entry'),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Create %r' % user1,
|
||||
command=(
|
||||
@@ -300,6 +308,49 @@ class test_user(Declarative):
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r' % user1,
|
||||
command=('user_mod', [user1], dict(setattr=u'uid=%s' % renameduser1)),
|
||||
expected=dict(
|
||||
result=dict(
|
||||
givenname=[u'Finkle'],
|
||||
homedirectory=[u'/home/tuser1'],
|
||||
loginshell=[u'/bin/sh'],
|
||||
sn=[u'User1'],
|
||||
uid=[renameduser1],
|
||||
memberof_group=[u'ipausers'],
|
||||
),
|
||||
summary=u'Modified user "%s"' % user1,
|
||||
value=user1,
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename %r to same value' % renameduser1,
|
||||
command=('user_mod', [renameduser1], dict(setattr=u'uid=%s' % renameduser1)),
|
||||
expected=errors.EmptyModlist(),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Rename back %r' % renameduser1,
|
||||
command=('user_mod', [renameduser1], dict(setattr=u'uid=%s' % user1)),
|
||||
expected=dict(
|
||||
result=dict(
|
||||
givenname=[u'Finkle'],
|
||||
homedirectory=[u'/home/tuser1'],
|
||||
loginshell=[u'/bin/sh'],
|
||||
sn=[u'User1'],
|
||||
uid=[user1],
|
||||
memberof_group=[u'ipausers'],
|
||||
),
|
||||
summary=u'Modified user "%s"' % renameduser1,
|
||||
value=renameduser1,
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
dict(
|
||||
desc='Delete %r' % user1,
|
||||
command=('user_del', [user1], {}),
|
||||
|
||||
Reference in New Issue
Block a user