diff --git a/apps/member/views.py b/apps/member/views.py index c0972e96..6ce8d4c5 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -183,14 +183,14 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): modified_note._force_save = True modified_note.save() context["can_force_lock"] = user.note.is_active and PermissionBackend\ - .check_perm(self.request, "note.change_note_is_active", modified_note) + .check_perm(self.request, "note.change_noteuser_is_active", modified_note) old_note._force_save = True old_note._no_signal = True old_note.save() modified_note.refresh_from_db() modified_note.is_active = True context["can_unlock_note"] = not user.note.is_active and PermissionBackend\ - .check_perm(self.request, "note.change_note_is_active", modified_note) + .check_perm(self.request, "note.change_noteuser_is_active", modified_note) return context @@ -452,23 +452,23 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): modified_note = NoteClub.objects.get(pk=club.note.pk) # Don't log these tests modified_note._no_signal = True - modified_note.is_active = True + modified_note.is_active = False modified_note.inactivity_reason = 'manual' context["can_lock_note"] = club.note.is_active and PermissionBackend \ - .check_perm(self.request, "note.change_noteuser_is_active", modified_note) + .check_perm(self.request, "note.change_noteclub_is_active", modified_note) old_note = NoteClub.objects.select_for_update().get(pk=club.note.pk) modified_note.inactivity_reason = 'forced' modified_note._force_save = True modified_note.save() context["can_force_lock"] = club.note.is_active and PermissionBackend \ - .check_perm(self.request, "note.change_note_is_active", modified_note) + .check_perm(self.request, "note.change_noteclub_is_active", modified_note) old_note._force_save = True old_note._no_signal = True old_note.save() modified_note.refresh_from_db() modified_note.is_active = True context["can_unlock_note"] = not club.note.is_active and PermissionBackend \ - .check_perm(self.request, "note.change_note_is_active", modified_note) + .check_perm(self.request, "note.change_noteclub_is_active", modified_note) return context diff --git a/apps/permission/fixtures/initial.json b/apps/permission/fixtures/initial.json index c2427f18..ee62cf18 100644 --- a/apps/permission/fixtures/initial.json +++ b/apps/permission/fixtures/initial.json @@ -2871,6 +2871,38 @@ "description": "Changer l'image de n'importe quelle note" } }, + { + "model": "permission.permission", + "pk": 184, + "fields": { + "model": [ + "note", + "noteclub" + ], + "query": "[\"AND\", {\"club\": [\"club\"]}, [\"OR\", {\"inactivity_reason\": \"manual\"}, {\"is_active\": true}]]", + "type": "change", + "mask": 3, + "field": "is_active", + "permanent": true, + "description": "(Dé)bloquer la note de son club manuellement" + } + }, + { + "model": "permission.permission", + "pk": 185, + "fields": { + "model": [ + "note", + "noteclub" + ], + "query": "[\"AND\", {\"club\": [\"club\"]}, [\"OR\", {\"inactivity_reason\": \"manual\"}, {\"is_active\": true}]]", + "type": "change", + "mask": 3, + "field": "inactivity_reason", + "permanent": true, + "description": "(Dé)bloquer la note de son club et indiquer que cela a été fait manuellement" + } + }, { "model": "permission.role", "pk": 1, @@ -3010,7 +3042,9 @@ 166, 167, 168, - 182 + 182, + 184, + 185 ] } }, @@ -3278,7 +3312,9 @@ 180, 181, 182, - 183 + 183, + 184, + 185 ] } },