Skip to content

Commit b6110e6

Browse files
committed
Fix unsafe assumption about org content type
1 parent 5a52b1c commit b6110e6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ansible_base/rbac/permission_registry.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,13 @@ def content_type_model(self):
186186

187187
@cached_property
188188
def org_ct_id(self):
189-
team_parent_model = self.get_parent_model(self.team_model)
190-
return self.content_type_model.objects.get_for_model(team_parent_model).id
189+
# This should be safe to import at top of file because it is ansible_base.lib
190+
# but it is not because of issue:
191+
# https://github.com/ansible/django-ansible-base/issues/443
192+
from ansible_base.lib.utils.auth import get_organization_model
193+
194+
org_model = get_organization_model()
195+
return self.content_type_model.objects.get_for_model(org_model).id
191196

192197
@property
193198
def permission_qs(self):

0 commit comments

Comments
 (0)