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

Fix permissions to lock our own note

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-12-13 18:27:24 +01:00
parent 9c8ea2cd41
commit 2f28e34cec
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 3 additions and 3 deletions

View File

@ -174,7 +174,7 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
modified_note = NoteUser.objects.get(pk=user.note.pk) modified_note = NoteUser.objects.get(pk=user.note.pk)
# Don't log these tests # Don't log these tests
modified_note._no_signal = True modified_note._no_signal = True
modified_note.is_active = True modified_note.is_active = False
modified_note.inactivity_reason = 'manual' modified_note.inactivity_reason = 'manual'
context["can_lock_note"] = user.note.is_active and PermissionBackend\ context["can_lock_note"] = user.note.is_active and PermissionBackend\
.check_perm(self.request, "note.change_noteuser_is_active", modified_note) .check_perm(self.request, "note.change_noteuser_is_active", modified_note)

View File

@ -2511,7 +2511,7 @@
"note", "note",
"noteuser" "noteuser"
], ],
"query": "[\"AND\", {\"user\": [\"user\"]}, [\"OR\", {\"inactivity_reason\": \"manual\"}, {\"inactivity_reason\": null}]]", "query": "[\"AND\", {\"user\": [\"user\"]}, [\"OR\", {\"inactivity_reason\": \"manual\"}, {\"is_active\": true}]]",
"type": "change", "type": "change",
"mask": 1, "mask": 1,
"field": "is_active", "field": "is_active",
@ -2527,7 +2527,7 @@
"note", "note",
"noteuser" "noteuser"
], ],
"query": "[\"AND\", {\"user\": [\"user\"]}, [\"OR\", {\"inactivity_reason\": \"manual\"}, {\"inactivity_reason\": null}]]", "query": "[\"AND\", {\"user\": [\"user\"]}, [\"OR\", {\"inactivity_reason\": \"manual\"}, {\"is_active\": true}]]",
"type": "change", "type": "change",
"mask": 1, "mask": 1,
"field": "inactivity_reason", "field": "inactivity_reason",