mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -234,14 +234,14 @@ Identities.prototype = {
|
||||
Admin.prototype.list_cb.call(this, data);
|
||||
var deloptions = {};
|
||||
|
||||
if (data.handle_mailboxes) {
|
||||
if (data.handle_mailboxes == "yes") {
|
||||
deloptions = {keepdir: gettext("Do not delete mailbox directory")};
|
||||
}
|
||||
$("a.filter").click($.proxy(this.filter_by_tag, this));
|
||||
|
||||
$("a[name=delaccount]").confirm({
|
||||
question: gettext("Delete this account?"),
|
||||
method: "DELETE",
|
||||
method: "POST",
|
||||
checkboxes: deloptions,
|
||||
success_cb: $.proxy(this.reload_listing, this)
|
||||
});
|
||||
|
||||
@@ -189,7 +189,7 @@ def identity_actions(user, ident):
|
||||
actions = events.raiseQueryEvent("ExtraAccountActions", ident)
|
||||
actions += [
|
||||
{"name" : "delaccount",
|
||||
"url" : reverse("modoboa.admin.views.delaccount") + "?selection=%s" % objid,
|
||||
"url" : reverse("modoboa.admin.views.delaccount", args=[objid]),
|
||||
"img" : "icon-trash",
|
||||
"title" : _("Delete this account")},
|
||||
]
|
||||
|
||||
@@ -134,8 +134,7 @@ class AccountTestCase(ModoTestCase):
|
||||
mb = Mailbox.objects.get(pk=mb.id)
|
||||
self.assertEqual(mb.full_address, "pouet@test.com")
|
||||
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount") + "?selection=%d" \
|
||||
% account.id, {})
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount", args=[account.id]), {})
|
||||
|
||||
def test_update_password(self):
|
||||
"""Password update
|
||||
@@ -305,11 +304,9 @@ class PermissionsTestCase(ModoTestCase):
|
||||
account = User.objects.get(username="superadmin2@test.com")
|
||||
self.clt.logout()
|
||||
self.clt.login(username="admin@test.com", password="toto")
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount") + "?selection=%d" \
|
||||
% account.id, {},
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount", args=[account.id]), {},
|
||||
status="ko", respmsg="Permission denied")
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount") + "?selection=%d" \
|
||||
% 4, {},
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount", args=[account.id]), {},
|
||||
status="ko", respmsg="Permission denied")
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ urlpatterns = patterns(
|
||||
(r'^accounts/list/$', 'accounts_list'),
|
||||
(r'^accounts/new/$', 'newaccount'),
|
||||
(r'^accounts/edit/(?P<accountid>\d+)/$', 'editaccount'),
|
||||
(r'^accounts/delete/$', 'delaccount'),
|
||||
(r'^accounts/delete/(?P<accountid>\d+)/$', 'delaccount'),
|
||||
|
||||
(r'^distriblists/new/$', 'newdlist'),
|
||||
(r'^distriblists/delete/$', 'deldlist'),
|
||||
|
||||
@@ -528,14 +528,12 @@ def editaccount(request, accountid, tplname="common/tabforms.html"):
|
||||
@login_required
|
||||
@permission_required("admin.delete_user")
|
||||
@transaction.commit_on_success
|
||||
def delaccount(request):
|
||||
selection = request.GET["selection"].split(",")
|
||||
keepdir = True if request.GET.get("keepdir", "false") == "true" else False
|
||||
def delaccount(request, accountid):
|
||||
keepdir = True if request.POST.get("keepdir", "false") == "true" else False
|
||||
|
||||
for account in User.objects.filter(id__in=selection):
|
||||
account.delete(request.user, keepdir)
|
||||
User.objects.get(pk=accountid).delete(request.user, keepdir)
|
||||
|
||||
msg = ungettext("Account deleted", "Accounts deleted", len(selection))
|
||||
msg = ungettext("Account deleted", "Accounts deleted", 1)
|
||||
return ajax_simple_response({"status": "ok", "respmsg": msg})
|
||||
|
||||
|
||||
|
||||
@@ -21,11 +21,9 @@ class PermissionsTestCase(ExtTestCase):
|
||||
account = User.objects.get(username="reseller@test.com")
|
||||
self.clt.logout()
|
||||
self.clt.login(username="admin@test.com", password="toto")
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount") + "?selection=%d" \
|
||||
% account.id, {},
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount", args=[account.id]), {},
|
||||
status="ko", respmsg="Permission denied")
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount") + "?selection=%d" \
|
||||
% 4, {},
|
||||
self.check_ajax_get(reverse("modoboa.admin.views.delaccount", args=[4]), {},
|
||||
status="ko", respmsg="Permission denied")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user