diff options
Diffstat (limited to 'ipa-server')
-rw-r--r-- | ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py | 19 | ||||
-rw-r--r-- | ipa-server/ipa-gui/ipagui/templates/delegateform.kid | 11 |
2 files changed, 28 insertions, 2 deletions
diff --git a/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py b/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py index 9f4ec6c43..2319b944a 100644 --- a/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py +++ b/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py @@ -56,6 +56,25 @@ class DelegationController(IPAController): turbogears.flash("Add delegation cancelled") raise turbogears.redirect('/delegate/list') + # Try to handle the case where the user entered just some data + # into the source/dest group name but didn't do a Find. We'll do + # our best to see if a group by that name exists and if so, use it. + dest_group_dn = kw.get('dest_group_dn') + dest_group_cn = kw.get('dest_group_cn') + if not dest_group_dn and dest_group_cn: + try: + group = client.get_entry_by_cn(dest_group_cn, ['dn']) + kw['dest_group_dn'] = group.dn + except: + kw['dest_group_cn'] = "Please choose:" + source_group_dn = kw.get('source_group_dn') + source_group_cn = kw.get('source_group_cn') + if not source_group_dn and source_group_cn: + try: + group = client.get_entry_by_cn(source_group_cn, ['dn']) + kw['source_group_dn'] = group.dn + except: + kw['source_group_cn'] = "Please choose:" tg_errors, kw = self.delegatevalidate(**kw) if tg_errors: turbogears.flash("There were validation errors.<br/>" + diff --git a/ipa-server/ipa-gui/ipagui/templates/delegateform.kid b/ipa-server/ipa-gui/ipagui/templates/delegateform.kid index d2be336c8..3f885fa03 100644 --- a/ipa-server/ipa-gui/ipagui/templates/delegateform.kid +++ b/ipa-server/ipa-gui/ipagui/templates/delegateform.kid @@ -4,6 +4,13 @@ <?python searchurl = tg.url('/delegate/group_search') ?> <script type="text/javascript"> + function lostFocus(which_group) { + /* The user has left the field, save what they put in there in case + * they don't do a Find. */ + group_cn_field = $('form_' + which_group + '_group_cn'); + group_criteria_field = $(which_group + '_criteria') + group_cn_field.value = group_criteria_field.value + } function enterDoSearch(e, which_group) { var keyPressed; @@ -105,7 +112,7 @@ </div> <div id="source_searcharea" style="display:none"> <input class="requiredfield" id="source_criteria" type="text" - onkeypress="return enterDoSearch(event, 'source');" /> + onkeypress="return enterDoSearch(event, 'source');" onblur="return lostFocus('source');"/> <input class="searchbutton" type="button" value="Find" onclick="return doSearch('source');" /> @@ -143,7 +150,7 @@ <div id="dest_searcharea" style="display:none"> <div> <input class="requiredfield" id="dest_criteria" type="text" - onkeypress="return enterDoSearch(event, 'dest');" /> + onkeypress="return enterDoSearch(event, 'dest');" onblur="return lostFocus('dest');"/> <input class="searchbutton" type="button" value="Find" onclick="return doSearch('dest');" /> |