1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Merge branch 'no_side_effect_permission_check' into 'beta'

No side effect permission check

See merge request bde/nk20!124
This commit is contained in:
ynerant 2020-09-20 11:24:46 +02:00
commit ac2d1e8111
2 changed files with 3 additions and 1 deletions

View File

@ -388,7 +388,7 @@ $('#btn_transfer').click(function () {
alias = sources_notes_display[0].name alias = sources_notes_display[0].name
source_id = user_note.id source_id = user_note.id
dest_id = special_note dest_id = special_note
reason = 'Retrait ' + $('#credit_type option:selected').text().toLowerCase() reason = 'Retrait ' + $('#debit_type option:selected').text().toLowerCase()
if (given_reason.length > 0) { reason += ' (' + given_reason + ')' } if (given_reason.length > 0) { reason += ' (' + given_reason + ')' }
} }
$.post('/api/note/transaction/transaction/', $.post('/api/note/transaction/transaction/',

View File

@ -43,6 +43,7 @@ class InstancedPermission:
obj = copy(obj) obj = copy(obj)
obj.pk = 0 obj.pk = 0
with transaction.atomic(): with transaction.atomic():
sid = transaction.savepoint()
for o in self.model.model_class().objects.filter(pk=0).all(): for o in self.model.model_class().objects.filter(pk=0).all():
o._force_delete = True o._force_delete = True
Model.delete(o) Model.delete(o)
@ -65,6 +66,7 @@ class InstancedPermission:
obj._no_signal = True obj._no_signal = True
obj._force_delete = True obj._force_delete = True
Model.delete(obj) Model.delete(obj)
transaction.savepoint_rollback(sid)
return ret return ret