diff options
author | Rob Crittenden <rcritten@redhat.com> | 2011-11-28 12:31:45 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-12-05 22:29:02 -0500 |
commit | 181e6da9d8d9ee601989f845356a3c5b31d2720b (patch) | |
tree | d87f42ed6c427da7eb00a93092cb8e35cc8f3429 /ipalib | |
parent | 59721431d29c5684924c1d76ffe1c59cd6149d97 (diff) | |
download | freeipa-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')
-rw-r--r-- | ipalib/plugins/dns.py | 10 | ||||
-rw-r--r-- | ipalib/plugins/group.py | 11 | ||||
-rw-r--r-- | ipalib/plugins/user.py | 12 |
3 files changed, 23 insertions, 10 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 7acb3df8a..d4f91af74 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -673,7 +673,7 @@ class dnszone(LDAPObject): default_from=lambda idnsname: 'hostmaster.%s' % idnsname, normalizer=normalize_zonemgr, ), - Int('idnssoaserial?', + Int('idnssoaserial', cli_name='serial', label=_('SOA serial'), doc=_('SOA record serial number'), @@ -681,7 +681,7 @@ class dnszone(LDAPObject): create_default=_create_zone_serial, autofill=True, ), - Int('idnssoarefresh?', + Int('idnssoarefresh', cli_name='refresh', label=_('SOA refresh'), doc=_('SOA record refresh time'), @@ -689,7 +689,7 @@ class dnszone(LDAPObject): default=3600, autofill=True, ), - Int('idnssoaretry?', + Int('idnssoaretry', cli_name='retry', label=_('SOA retry'), doc=_('SOA record retry time'), @@ -697,7 +697,7 @@ class dnszone(LDAPObject): default=900, autofill=True, ), - Int('idnssoaexpire?', + Int('idnssoaexpire', cli_name='expire', label=_('SOA expire'), doc=_('SOA record expire time'), @@ -705,7 +705,7 @@ class dnszone(LDAPObject): minvalue=0, autofill=True, ), - Int('idnssoaminimum?', + Int('idnssoaminimum', cli_name='minimum', label=_('SOA minimum'), doc=_('How long should negative responses be cached'), 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) diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py index d3e63ef9a..a3c17dc4c 100644 --- a/ipalib/plugins/user.py +++ b/ipalib/plugins/user.py @@ -187,7 +187,7 @@ class user(LDAPObject): cli_name='last', label=_('Last name'), ), - Str('cn?', + Str('cn', label=_('Full name'), default_from=lambda givenname, sn: '%s %s' % (givenname, sn), autofill=True, @@ -202,10 +202,11 @@ class user(LDAPObject): default_from=lambda givenname, sn: '%c%c' % (givenname[0], sn[0]), autofill=True, ), - Str('homedirectory?', + Str('homedirectory', cli_name='homedir', label=_('Home directory'), default_from=lambda uid: '/home/%s' % uid, + autofill=True, ), Str('gecos?', label=_('GECOS field'), @@ -237,7 +238,7 @@ class user(LDAPObject): # bomb out via the webUI. exclude='webui', ), - Int('uidnumber?', + Int('uidnumber', cli_name='uid', label=_('UID'), doc=_('User ID Number (system will assign one if not provided)'), @@ -245,10 +246,11 @@ class user(LDAPObject): default=999, minvalue=1, ), - Int('gidnumber?', + Int('gidnumber', label=_('GID'), doc=_('Group ID Number'), - default_from=lambda uid: uid, + default_from=lambda uidnumber: uidnumber, + autofill=True, ), Str('street?', cli_name='street', |