From bea7818adde2712be3ee052634bdf314fd63b5da Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 6 Jul 2011 17:45:53 -0400 Subject: Remove the ability to create new HBAC deny rules. New rules will all be allow type. Existing rules cannot be changed to deny. The type attribute now defaults to allow with autofill so it won't be prompted in interactive mode in the cli. https://fedorahosted.org/freeipa/ticket/1432 --- ipalib/plugins/hbacrule.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ipalib') diff --git a/ipalib/plugins/hbacrule.py b/ipalib/plugins/hbacrule.py index 2488b1d91..2dcdddd58 100644 --- a/ipalib/plugins/hbacrule.py +++ b/ipalib/plugins/hbacrule.py @@ -87,6 +87,10 @@ from ipalib import _, ngettext topic = ('hbac', 'Host-based access control commands') +def validate_type(ugettext, type): + if type.lower() == 'deny': + raise errors.ValidationError(name='type', error=_('The deny type has been deprecated.')) + def is_all(options, attribute): """ See if options[attribute] is lower-case 'all' in a safe way. @@ -132,11 +136,13 @@ class hbacrule(LDAPObject): label=_('Rule name'), primary_key=True, ), - StrEnum('accessruletype', + StrEnum('accessruletype', validate_type, cli_name='type', - doc=_('Rule type (allow or deny)'), + doc=_('Rule type (allow)'), label=_('Rule type'), values=(u'allow', u'deny'), + default=u'allow', + autofill=True, ), # FIXME: {user,host,sourcehost,service}categories should expand in the future StrEnum('usercategory?', -- cgit