Skip to content

Commit

Permalink
Changed permissions
Browse files Browse the repository at this point in the history
Everyone at MAKE should be able to both view, add, change and delete lore articles. This must be added to permissions for the general MAKE group.
  • Loading branch information
Gunvor4 committed Sep 8, 2023
1 parent 523424a commit 0b05f7b
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/internal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,7 @@ def get_success_url(self):
class LoreUpdateView(PermissionRequiredMixin, LoreFormMixin, UpdateView):
form_title = _("Edit lore article")
back_button_text = _("Lore article")

def has_permission(self):
return (
self.request.user.has_perm('internal.change_lore')
or self.request.user == self.get_object().author
)
permission_required = ('internal.change_lore',)

def get_back_button_link(self):
title = self.get_form_kwargs()['instance']
Expand All @@ -419,9 +414,5 @@ def get_success_url(self):
class LoreDeleteView(PermissionRequiredMixin, PreventGetRequestsMixin, DeleteView):
model = Lore
success_url = reverse_lazy('lore_list')

def has_permission(self):
return (
self.request.user.has_perm('internal.delete_lore')
or self.request.user == self.get_object().author
)
permission_required = ('internal.delete_lore',)

0 comments on commit 0b05f7b

Please sign in to comment.