fix(access): Add HTTP/Method=DELETE as valid option for object delete/destroy.

ref: #442 #454
This commit is contained in:
2024-12-26 15:31:02 +09:30
parent 4545b3d721
commit 10becacbf7
2 changed files with 9 additions and 3 deletions

View File

@ -184,7 +184,10 @@ class OrganizationMixin:
view_action = 'change'
elif self.action == 'destroy':
elif(
self.action == 'destroy'
or getattr(self.request._stream, 'method', '') == 'DELETE'
):
view_action = 'delete'

View File

@ -120,7 +120,10 @@ class OrganizationPermissionMixin(
obj = view.get_object()
)
elif view.action == 'destroy':
elif(
view.action == 'destroy'
or getattr(view.request._stream, 'method', '') == 'DELETE'
):
view_action = 'delete'
@ -146,7 +149,7 @@ class OrganizationPermissionMixin(
return True
if view_action is None:
raise ValueError('view_action could not be defined.')