mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-15 10:51:56 -06:00
Adds deletion for delegations.
The deletion is only triggered via javascript, so they must hit confirm.
This commit is contained in:
parent
1592229c3c
commit
3db0f99977
@ -206,6 +206,10 @@ body {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.deletebutton {
|
||||
background: #ee2222;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used for checkboxlist of aci attributes
|
||||
*/
|
||||
|
@ -196,6 +196,42 @@ class DelegationController(IPAController):
|
||||
return dict(aci_list=aci_list, group_dn_to_cn=group_dn_to_cn,
|
||||
fields=ipagui.forms.delegate.DelegateFields())
|
||||
|
||||
@expose()
|
||||
@identity.require(identity.not_anonymous())
|
||||
def delete(self, acistr):
|
||||
"""Display delegate page"""
|
||||
self.restrict_post()
|
||||
client = self.get_ipaclient()
|
||||
|
||||
try:
|
||||
aci_entry = client.get_aci_entry(aci_fields)
|
||||
|
||||
aci_str_list = aci_entry.getValues('aci')
|
||||
if aci_str_list is None:
|
||||
aci_str_list = []
|
||||
if not(isinstance(aci_str_list,list) or isinstance(aci_str_list,tuple)):
|
||||
aci_str_list = [aci_str_list]
|
||||
|
||||
try :
|
||||
old_aci_index = aci_str_list.index(acistr)
|
||||
except ValueError:
|
||||
turbogears.flash("Delegation deletion failed:<br />" +
|
||||
"The delegation you were attempting to delete has been " +
|
||||
"concurrently modified.")
|
||||
raise turbogears.redirect('/delegate/list')
|
||||
|
||||
new_aci_str_list = copy.copy(aci_str_list)
|
||||
del new_aci_str_list[old_aci_index]
|
||||
aci_entry.setValue('aci', new_aci_str_list)
|
||||
|
||||
client.update_entry(aci_entry)
|
||||
|
||||
turbogears.flash("delegate deleted")
|
||||
raise turbogears.redirect('/delegate/list')
|
||||
except (SyntaxError, ipaerror.IPAError), e:
|
||||
turbogears.flash("Delegation deletion failed: " + str(e))
|
||||
raise turbogears.redirect('/delegate/list')
|
||||
|
||||
@expose("ipagui.templates.delegategroupsearch")
|
||||
@identity.require(identity.not_anonymous())
|
||||
def group_search(self, **kw):
|
||||
|
@ -43,8 +43,20 @@
|
||||
new Effect.Fade($(which_group + '_searcharea'), {duration: 0.25});
|
||||
new Effect.Appear($(which_group + '_change_link'), {duration: 0.25});
|
||||
}
|
||||
|
||||
function confirmDelete() {
|
||||
if (confirm("Are you sure you want to delete this delegation?")) {
|
||||
$('deleteform').submit();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<form style="display:none" id='deleteform'
|
||||
method="post" action="${tg.url('/delegate/delete')}">
|
||||
<input type="hidden" name="acistr" value="${value.get('orig_acistr')}" />
|
||||
</form>
|
||||
|
||||
<form action="${action}" name="${name}" method="${method}" class="tableform">
|
||||
|
||||
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
|
||||
@ -59,6 +71,14 @@
|
||||
value="Cancel ${actionname}"/>
|
||||
<br/><br/>
|
||||
</td>
|
||||
<td py:if='actionname == "Edit"'>
|
||||
|
||||
<input type="button" class="deletebutton"
|
||||
value="Delete Delegation"
|
||||
onclick="return confirmDelete();"
|
||||
/>
|
||||
<br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -159,6 +179,14 @@
|
||||
<input type="submit" class="submitbutton" name="submit"
|
||||
value="Cancel ${actionname}"/>
|
||||
</td>
|
||||
<td py:if='actionname == "Edit"'>
|
||||
<br/>
|
||||
|
||||
<input type="button" class="deletebutton"
|
||||
value="Delete Delegation"
|
||||
onclick="return confirmDelete();"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user