mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Escape hatch if role not required
This commit is contained in:
parent
0e971c468b
commit
81e9fd7a44
@ -63,7 +63,8 @@ class RolePermission(permissions.BasePermission):
|
|||||||
role = getattr(view, 'role_required', None)
|
role = getattr(view, 'role_required', None)
|
||||||
|
|
||||||
if not role:
|
if not role:
|
||||||
raise AttributeError(f"'role_required' not specified for view {type(view).__name__}")
|
# Role not specified - allow access
|
||||||
|
return True
|
||||||
|
|
||||||
roles = []
|
roles = []
|
||||||
|
|
||||||
|
@ -373,6 +373,8 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
queryset = Part.objects.all()
|
queryset = Part.objects.all()
|
||||||
|
|
||||||
|
role_required = 'part'
|
||||||
|
|
||||||
starred_parts = None
|
starred_parts = None
|
||||||
|
|
||||||
def get_serializer(self, *args, **kwargs):
|
def get_serializer(self, *args, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user