Coverage for audoma_api/permissions.py: 67%
18 statements
« prev ^ index » next coverage.py v6.4.2, created at 2022-08-04 07:22 +0000
« prev ^ index » next coverage.py v6.4.2, created at 2022-08-04 07:22 +0000
1from rest_framework.permissions import BasePermission
4class ViewAndDetailPermission(BasePermission):
5 """The ViewAndDetailPermission guard access to all views nad detail views (collections and resources).
6 General view permission is determined first then if it's detail view specific object permission is checked.
7 """
9 def has_permission(self, request, view):
10 return True
12 def has_object_permission(self, request, view, obj):
13 return True
16class DetailPermission(BasePermission):
17 """The DetailPermission guard access to Detail Views (resources)."""
19 def has_object_permission(self, request, view, obj):
20 return True
23class ViewPermission(BasePermission):
24 """The ViewPermission guard access to all views in ViewSet (collections and resources)."""
26 def has_permission(self, request, view):
27 return True
30class AlternatePermission1(BasePermission):
31 """The AlternatePermission1 is combined through OR operator with AlternatePermission2"""
33 def has_permission(self, request, view):
34 return True
37class AlternatePermission2(BasePermission):
38 """The AlternatePermission2 is combined through OR operator with AlternatePermission1"""
40 def has_permission(self, request, view):
41 return True
44# check_object_permissions