mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add additional detail to error messages.
This runs the risk of showing too much and confusing users but on the other hand it often includes required information detailing why the error occurred such as what attribute the user lacks write access too and why changing a password failed. 438057
This commit is contained in:
parent
402187c838
commit
1a1e020258
@ -144,7 +144,7 @@ class DelegationController(IPAController):
|
||||
pass
|
||||
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Delgate add failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Delgate add failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=delegate_form, delegate=kw,
|
||||
tg_template='ipagui.templates.delegatenew')
|
||||
|
||||
@ -174,7 +174,7 @@ class DelegationController(IPAController):
|
||||
|
||||
return dict(form=delegate_form, delegate=delegate)
|
||||
except (SyntaxError, ipaerror.IPAError), e:
|
||||
turbogears.flash("Delegation edit failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Delegation edit failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect('/delegate/list')
|
||||
|
||||
|
||||
@ -259,7 +259,7 @@ class DelegationController(IPAController):
|
||||
turbogears.flash("delegate updated")
|
||||
raise turbogears.redirect('/delegate/list')
|
||||
except (SyntaxError, ipaerror.IPAError), e:
|
||||
turbogears.flash("Delegation update failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Delegation update failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=delegate_form, delegate=kw,
|
||||
tg_template='ipagui.templates.delegateedit')
|
||||
|
||||
@ -272,7 +272,7 @@ class DelegationController(IPAController):
|
||||
try:
|
||||
aci_entry = client.get_aci_entry(aci_fields)
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Delegation list failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Delegation list failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect('/')
|
||||
|
||||
aci_str_list = aci_entry.getValues('aci')
|
||||
@ -351,7 +351,7 @@ class DelegationController(IPAController):
|
||||
turbogears.flash("delegate deleted")
|
||||
raise turbogears.redirect('/delegate/list')
|
||||
except (SyntaxError, ipaerror.IPAError), e:
|
||||
turbogears.flash("Delegation deletion failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Delegation deletion failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect('/delegate/list')
|
||||
|
||||
@expose("ipagui.templates.delegategroupsearch")
|
||||
|
@ -101,7 +101,7 @@ class GroupController(IPAController):
|
||||
return dict(form=group_new_form, group=kw,
|
||||
tg_template='ipagui.templates.groupnew')
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Group add failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Group add failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=group_new_form, group=kw,
|
||||
tg_template='ipagui.templates.groupnew')
|
||||
|
||||
@ -293,7 +293,7 @@ class GroupController(IPAController):
|
||||
#
|
||||
kw['group_orig'] = b64encode(dumps(new_group.toDict()))
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Group update failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Group update failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=group_edit_form, group=kw, members=member_dicts,
|
||||
tg_template='ipagui.templates.groupedit')
|
||||
|
||||
@ -322,7 +322,7 @@ class GroupController(IPAController):
|
||||
kw['dnadd'] = failed_adds
|
||||
group_modified = True
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Updating group membership failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Updating group membership failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=group_edit_form, group=kw, members=member_dicts,
|
||||
tg_template='ipagui.templates.groupedit')
|
||||
|
||||
@ -340,7 +340,7 @@ class GroupController(IPAController):
|
||||
kw['dndel'] = failed_dels
|
||||
group_modified = True
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Updating group membership failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Updating group membership failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=group_edit_form, group=kw, members=member_dicts,
|
||||
tg_template='ipagui.templates.groupedit')
|
||||
|
||||
@ -391,7 +391,7 @@ class GroupController(IPAController):
|
||||
turbogears.flash("These results are truncated.<br />" +
|
||||
"Please refine your search and try again.")
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Find groups failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Find groups failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect("/group/list")
|
||||
|
||||
return dict(groups=groups, criteria=criteria,
|
||||
@ -435,7 +435,7 @@ class GroupController(IPAController):
|
||||
turbogears.flash("group deleted")
|
||||
raise turbogears.redirect('/group/list')
|
||||
except (SyntaxError, ipaerror.IPAError), e:
|
||||
turbogears.flash("Group deletion failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Group deletion failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect('/group/list')
|
||||
|
||||
@validate(form=group_new_form)
|
||||
|
@ -198,7 +198,7 @@ class IPAPolicyController(IPAController):
|
||||
turbogears.flash("IPA Policy updated")
|
||||
raise turbogears.redirect('/ipapolicy/show')
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Policy update failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Policy update failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=ipapolicy_edit_form, ipapolicy=kw,
|
||||
tg_template='ipagui.templates.ipapolicyedit')
|
||||
|
||||
|
@ -103,7 +103,7 @@ class PrincipalController(IPAController):
|
||||
return dict(form=principal_new_form, principal=kw,
|
||||
tg_template='ipagui.templates.principalnew')
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("Service principal add failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Service principal add failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=principal_new_form, principal=kw,
|
||||
tg_template='ipagui.templates.principalnew')
|
||||
|
||||
@ -137,7 +137,7 @@ class PrincipalController(IPAController):
|
||||
principals[i].setValue('hostname', h[0])
|
||||
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("principal list failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("principal list failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect("/principal/list")
|
||||
|
||||
return dict(principals=principals, hostname=hostname, fields=ipagui.forms.principal.PrincipalFields())
|
||||
@ -184,7 +184,7 @@ class PrincipalController(IPAController):
|
||||
turbogears.flash("Service principal deleted")
|
||||
raise turbogears.redirect('/principal/list')
|
||||
except (SyntaxError, ipaerror.IPAError), e:
|
||||
turbogears.flash("Service principal deletion failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("Service principal deletion failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect('/principal/list')
|
||||
|
||||
@validate(form=principal_new_form)
|
||||
|
@ -237,7 +237,7 @@ class UserController(IPAController):
|
||||
return dict(form=user_new_form, user=kw,
|
||||
tg_template='ipagui.templates.usernew')
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("User add failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User add failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=user_new_form, user=kw,
|
||||
tg_template='ipagui.templates.usernew')
|
||||
|
||||
@ -403,7 +403,7 @@ class UserController(IPAController):
|
||||
except ipaerror.IPAError, e:
|
||||
if uid is None:
|
||||
uid = principal
|
||||
turbogears.flash("User edit failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User edit failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect('/user/show', uid=uid)
|
||||
|
||||
@expose()
|
||||
@ -537,7 +537,7 @@ class UserController(IPAController):
|
||||
# too much work to figure out unless someone really screams
|
||||
pass
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("User update failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User update failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=user_edit_form, user=kw,
|
||||
user_groups=user_groups_dicts,
|
||||
tg_template='ipagui.templates.useredit')
|
||||
@ -549,7 +549,7 @@ class UserController(IPAController):
|
||||
if password_change:
|
||||
rv = client.modifyPassword(orig_user_dict['krbprincipalname'], "", kw.get('krbprincipalkey'))
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("User password change failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User password change failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=user_edit_form, user=kw,
|
||||
user_groups=user_groups_dicts,
|
||||
tg_template='ipagui.templates.useredit')
|
||||
@ -610,7 +610,7 @@ class UserController(IPAController):
|
||||
elif kw.get('nsAccountLock') == "true" and new_user.nsaccountlock != "true":
|
||||
client.mark_user_inactive(kw.get('uid'))
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("User status change failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User status change failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
return dict(form=user_edit_form, user=kw,
|
||||
user_groups=user_groups_dicts,
|
||||
tg_template='ipagui.templates.useredit')
|
||||
@ -637,7 +637,7 @@ class UserController(IPAController):
|
||||
turbogears.flash("These results are truncated.<br />" +
|
||||
"Please refine your search and try again.")
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("User list failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User list failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect("/user/list")
|
||||
|
||||
return dict(users=users, uid=uid, fields=ipagui.forms.user.UserFields())
|
||||
@ -680,7 +680,7 @@ class UserController(IPAController):
|
||||
user_groups=user_groups, user_reports=user_reports,
|
||||
user_manager=user_manager, user_secretary=user_secretary)
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("User show failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User show failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect("/")
|
||||
|
||||
@expose()
|
||||
@ -696,7 +696,7 @@ class UserController(IPAController):
|
||||
turbogears.flash("user deleted")
|
||||
raise turbogears.redirect('/user/list')
|
||||
except (SyntaxError, ipaerror.IPAError), e:
|
||||
turbogears.flash("User deletion failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("User deletion failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
raise turbogears.redirect('/user/list')
|
||||
|
||||
@validate(form=user_new_form)
|
||||
@ -818,7 +818,7 @@ class UserController(IPAController):
|
||||
users_counter = users[0]
|
||||
users = users[1:]
|
||||
except ipaerror.IPAError, e:
|
||||
turbogears.flash("search failed: " + str(e) + "<br/>" + e.detail[0]['desc'])
|
||||
turbogears.flash("search failed: " + str(e) + "<br/>" + e.detail[0].get('desc','') + ". " + e.detail[0].get('info',''))
|
||||
|
||||
return dict(users=users, criteria=criteria,
|
||||
which_select=kw.get('which_select'),
|
||||
|
Loading…
Reference in New Issue
Block a user