diff options
author | Rob Crittenden <rcritten@redhat.com> | 2009-04-29 22:24:15 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-05-04 17:43:00 -0400 |
commit | d4076915cd8f5c0ed7dc430f6f91ff059b4d7a35 (patch) | |
tree | 8cda9c725cad5dc3e31518ce520ed8f04ca0e5a3 /ipalib/plugins/group.py | |
parent | 064240def3e5fe1d0e75020b4a63a130e5232733 (diff) | |
download | freeipa.git-d4076915cd8f5c0ed7dc430f6f91ff059b4d7a35.tar.gz freeipa.git-d4076915cd8f5c0ed7dc430f6f91ff059b4d7a35.tar.xz freeipa.git-d4076915cd8f5c0ed7dc430f6f91ff059b4d7a35.zip |
Add posixGroup to the objectclass list if gidnumber is set
498335
Diffstat (limited to 'ipalib/plugins/group.py')
-rw-r--r-- | ipalib/plugins/group.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py index 766d1679..fb9a4532 100644 --- a/ipalib/plugins/group.py +++ b/ipalib/plugins/group.py @@ -81,11 +81,11 @@ class group_add(basegroup_add): # some required objectclasses kw['objectclass'] = config.get('ipagroupobjectclasses') - if kw.get('posix'): + if kw.get('posix') or kw.get('gidnumber'): kw['objectclass'].append('posixGroup') - del kw['posix'] + if kw.has_key('posix'): + del kw['posix'] -# return ldap.create(**entry) return super(group_add, self).execute(cn, **kw) api.register(group_add) @@ -152,20 +152,28 @@ class group_mod(basegroup_mod): """ assert 'cn' not in kw assert 'dn' not in kw + oldgroup = None + + if kw.has_key('gidnumber') or kw.get('posix'): + groupkw = {'all': True} + oldgroup = api.Command['group_show'](cn, **groupkw) # Are we promoting a non-posix group into a posix one? We just # need to add the posixGroup objectclass to the list and the # DNA plugin will handle assigning a new gidNumber for us. if kw.get('posix'): - groupkw = {'all': True} - oldgroup = api.Command['group_show'](cn, **groupkw) if oldgroup.get('gidnumber'): raise errors.AlreadyPosixGroup else: oldgroup['objectclass'].append('posixgroup') kw['objectclass'] = oldgroup['objectclass'] + if kw.has_key('gidnumber') and not oldgroup.has_key('gidnumber'): + oldgroup['objectclass'].append('posixgroup') + kw['objectclass'] = oldgroup['objectclass'] + if kw.has_key('posix'): + # we want this gone whether it is True or False del kw['posix'] if isinstance(kw.get('gidnumber',''), int): |