summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-03-24 17:03:40 -0400
committerRob Crittenden <rcritten@redhat.com>2008-03-24 17:03:40 -0400
commit749c396aaec1de4fd6f70211d99af9970e543203 (patch)
treeebf82ea52fdc9e2ec5056915a54aded028d6bb93 /ipa-server/ipa-gui
parent4b4a13c20140b08b075611b93c5edf281a2f30ea (diff)
downloadfreeipa-749c396aaec1de4fd6f70211d99af9970e543203.tar.gz
freeipa-749c396aaec1de4fd6f70211d99af9970e543203.tar.xz
freeipa-749c396aaec1de4fd6f70211d99af9970e543203.zip
On the delegation edit screen allow the direct entry of a group name
Fix the redirection errors, it was going to back to the Add delegation page 438257
Diffstat (limited to 'ipa-server/ipa-gui')
-rw-r--r--ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py b/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py
index c6523698d..3f80da523 100644
--- a/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py
+++ b/ipa-server/ipa-gui/ipagui/subcontrollers/delegation.py
@@ -189,12 +189,32 @@ class DelegationController(IPAController):
turbogears.flash("Edit 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_cn = kw.get('dest_group_cn')
+ if dest_group_cn:
+ try:
+ group = client.get_entry_by_cn(dest_group_cn, ['dn'])
+ kw['dest_group_dn'] = group.dn
+ except:
+ # This _notfound value is used in delegatevalidate()
+ kw['dest_group_cn_notfound'] = True
+ source_group_cn = kw.get('source_group_cn')
+ if source_group_cn:
+ try:
+ group = client.get_entry_by_cn(source_group_cn, ['dn'])
+ kw['source_group_dn'] = group.dn
+ except:
+ # This _notfound value is used in delegatevalidate()
+ kw['source_group_cn_notfound'] = True
+
tg_errors, kw = self.delegatevalidate(**kw)
if tg_errors:
turbogears.flash("There were validation errors.<br/>" +
"Please see the messages below for details.")
return dict(form=delegate_form, delegate=kw,
- tg_template='ipagui.templates.delegatenew')
+ tg_template='ipagui.templates.delegateedit')
try:
aci_entry = client.get_aci_entry(aci_fields)
@@ -383,9 +403,13 @@ class DelegationController(IPAController):
def delegatevalidate(self, tg_errors=None, **kw):
# We are faking this because otherwise it shows up as one huge
# block of color in the UI when it has a not empty validator.
+ if not tg_errors:
+ tg_errors = {}
if not kw.get('attrs'):
- if not tg_errors:
- tg_errors = {}
tg_errors['attrs'] = _("Please select at least one value")
- cherrypy.request.validation_errors = tg_errors
+ if kw.get('dest_group_cn_notfound'):
+ tg_errors['dest_group_dn'] = _("Group not found")
+ if kw.get('source_group_cn_notfound'):
+ tg_errors['source_group_dn'] = _("Group not found")
+ cherrypy.request.validation_errors = tg_errors
return tg_errors, kw