From 85843cc6ad2d1e893cd7f6c52fd1abb0ab89636d Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Sun, 17 Apr 2016 10:20:38 -0400 Subject: [PATCH] Fixed up some RBAC indexing --- awx/main/migrations/0008_v300_rbac_changes.py | 2 +- awx/main/models/rbac.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/main/migrations/0008_v300_rbac_changes.py b/awx/main/migrations/0008_v300_rbac_changes.py index 79684e9a5f..52c8bcfc3c 100644 --- a/awx/main/migrations/0008_v300_rbac_changes.py +++ b/awx/main/migrations/0008_v300_rbac_changes.py @@ -97,7 +97,7 @@ class Migration(migrations.Migration): ), migrations.AlterIndexTogether( name='roleancestorentry', - index_together=set([('descendent', 'content_type_id', 'role_field'), ('ancestor', 'content_type_id', 'role_field')]), + index_together=set([('ancestor', 'content_type_id', 'object_id'), ('ancestor', 'content_type_id', 'role_field')]), ), migrations.AddField( diff --git a/awx/main/models/rbac.py b/awx/main/models/rbac.py index d09d7d2dda..39c73cbe2f 100644 --- a/awx/main/models/rbac.py +++ b/awx/main/models/rbac.py @@ -360,8 +360,8 @@ class RoleAncestorEntry(models.Model): verbose_name_plural = _('role_ancestors') db_table = 'main_rbac_role_ancestors' index_together = [ - ("ancestor", "content_type_id", "role_field"), - ("descendent", "content_type_id", "role_field"), + ("ancestor", "content_type_id", "object_id"), # used by get_roles_on_resource + ("ancestor", "content_type_id", "role_field"), # used by accessible_objects ] descendent = models.ForeignKey(Role, null=False, on_delete=models.CASCADE, related_name='+')