Commit 109b1a38 authored by Alex Pyrgiotis's avatar Alex Pyrgiotis

admin: Wrap astakos actions in a transaction

Wrap actions that involve Astakos resources with the `commit_on_success`
transaction decorator. The action functions that involve Cyclades
objects do not need it since they use it internally.
parent 7cb080e2
......@@ -22,6 +22,7 @@ from django.utils.html import escape
from synnefo.db.models import (VirtualMachine, Network, Volume,
IPAddress)
from astakos.im.models import AstakosUser, Project
from astakos.im import transaction
from synnefo_admin import admin_settings
from synnefo_admin.admin.actions import (has_permission_or_403,
......@@ -191,6 +192,7 @@ JSON_CLASS = ProjectJSONView
@has_permission_or_403(cached_actions)
@transaction.commit_on_success
def do_action(request, op, id):
"""Apply the requested action on the specified user."""
if op == "contact":
......
......@@ -23,6 +23,7 @@ from synnefo.db.models import (VirtualMachine, Network, IPAddressLog, Volume,
NetworkInterface, IPAddress)
from astakos.im.models import AstakosUser, Project
from astakos.im import user_logic as users
from astakos.im import transaction
from django.db.models import Q
......@@ -161,6 +162,7 @@ JSON_CLASS = UserJSONView
@has_permission_or_403(cached_actions)
@transaction.commit_on_success
def do_action(request, op, id):
"""Apply the requested action on the specified user."""
user = get_user_or_404(id)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment