Skip to content

Commit

Permalink
fix(generic): use custom permission solution in views
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Feb 15, 2024
1 parent 0ec25df commit edb783e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis_core/generic/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.views.generic import DetailView
from django.views.generic.base import TemplateView
Expand Down Expand Up @@ -64,6 +65,9 @@ def get_template_names(self):
return template_names

def get_permission_required(self):
if hasattr(settings, "APIS_VIEW_PASSES_TEST"):
if settings.APIS_VIEW_PASSES_TEST(self):
return []
if hasattr(self, "permission_action_required"):
return [permission_fullname(self.permission_action_required, self.model)]
return []
Expand Down

0 comments on commit edb783e

Please sign in to comment.