mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user