From 152530931671f2b7d21304f773667d3be7cbbd8c Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: May 13 2008 15:57:56 +0000 Subject: The admin user doesn't have the inetorgperson objectclass so don't have a givenname attribute. The UI is currently hardcoded to require "first name" which renders the admin user uneditable via the UI. This is a hack that will allow admin to be edited, assuming that one doesn't try to add a firstname field. 440548 --- diff --git a/ipa-server/ipa-gui/ipagui/subcontrollers/user.py b/ipa-server/ipa-gui/ipagui/subcontrollers/user.py index 0a79fc7..9232f30 100644 --- a/ipa-server/ipa-gui/ipagui/subcontrollers/user.py +++ b/ipa-server/ipa-gui/ipagui/subcontrollers/user.py @@ -413,6 +413,16 @@ class UserController(IPAController): # later the update will not be processed cherrypy.session['uid'] = user_dict.get('uid') + # Hack. The admin user doesn't have inetorgperson as an + # objectclass so don't require the givenName attribute if + # this objectclass doesn't exist in the record. + oc = [x.lower() for x in user_dict.get('objectclass')] + try: + p = oc.index('inetorgperson') + except ValueError: + # This entry doesn't have inetorgperson so don't require gn + user_edit_form.validator.fields.get('givenname').not_empty=False + return dict(form=user_edit_form, user=user_dict, user_groups=user_groups_dicts) except ipaerror.IPAError, e: