summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/group.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-11-28 12:31:45 -0500
committerRob Crittenden <rcritten@redhat.com>2011-12-05 22:29:02 -0500
commit181e6da9d8d9ee601989f845356a3c5b31d2720b (patch)
treed87f42ed6c427da7eb00a93092cb8e35cc8f3429 /ipalib/plugins/group.py
parent59721431d29c5684924c1d76ffe1c59cd6149d97 (diff)
downloadfreeipa-181e6da9d8d9ee601989f845356a3c5b31d2720b.tar.gz
freeipa-181e6da9d8d9ee601989f845356a3c5b31d2720b.tar.xz
freeipa-181e6da9d8d9ee601989f845356a3c5b31d2720b.zip
Mark some attributes required to match the schema.
This makes no changes to the functionality in the command-line or GUI because these all have defaults anyway. This is mostly to show them properly in the UI and prevent someone from trying to erase the value (and getting a nasty schema error in response). https://fedorahosted.org/freeipa/ticket/2015
Diffstat (limited to 'ipalib/plugins/group.py')
-rw-r--r--ipalib/plugins/group.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ipalib/plugins/group.py b/ipalib/plugins/group.py
index 4872872ac..49bc82328 100644
--- a/ipalib/plugins/group.py
+++ b/ipalib/plugins/group.py
@@ -202,8 +202,19 @@ class group_mod(LDAPUpdate):
entry_attrs['objectclass'] = old_entry_attrs['objectclass']
if not 'gidnumber' in options:
entry_attrs['gidnumber'] = 999
+ # Can't check for this in a validator because we lack context
+ if 'gidnumber' in options and options['gidnumber'] is None:
+ raise errors.RequirementError(name='gid')
return dn
+ def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs):
+ # Check again for GID requirement in case someone tried to clear it
+ # using --setattr.
+ if isinstance(exc, errors.ObjectclassViolation):
+ if 'gidNumber' in exc.message and 'posixGroup' in exc.message:
+ raise errors.RequirementError(name='gid')
+ raise exc
+
api.register(group_mod)