Skip to content

Instantly share code, notes, and snippets.

@tyler274
Created May 26, 2016 05:06
Show Gist options
  • Save tyler274/8e2d8a774aba5d25e98aa219d989404a to your computer and use it in GitHub Desktop.
Save tyler274/8e2d8a774aba5d25e98aa219d989404a to your computer and use it in GitHub Desktop.
from ipalib.plugins import user
from ipalib.parameters import Int, Str
from ipalib import _
houses = [
'Dabney',
'Blacker',
'Ricketts',
'Fleming',
'Page',
'Lloyd',
'Ruddock',
'Avery',
]
def validate_house(ugettext, value):
if value not in houses:
return _("Please enter one of the eight houses")
user.user.takes_params = user.user.takes_params + (
Str('house*', validate_house,
cli_name='house',
label=_('House Membership'),
),
)
user.user.default_attributes.append('house')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment