fix(access): during permission check use post request params for an add action

!13
This commit is contained in:
2024-05-29 03:24:32 +09:30
parent 80c3af32d5
commit 6cb69c627f
2 changed files with 24 additions and 8 deletions

View File

@ -16,17 +16,33 @@ class OrganizationMixin():
def object_organization(self) -> int:
if 'access.models.Organization' in str(type(self.get_object())):
id = None
id = self.get_object().id
try:
else:
self.get_queryset()
id = self.get_object().organization.id
self.get_object()
if self.get_object().is_global:
if 'access.models.Organization' in str(type(self.get_object())):
id = 0
id = self.get_object().id
else:
id = self.get_object().organization.id
if self.get_object().is_global:
id = 0
except AttributeError:
if self.request.method == 'POST':
if self.request.POST.get("organization", ""):
id = int(self.request.POST.get("organization", ""))
return id