diff --git a/awx/main/models/rbac.py b/awx/main/models/rbac.py index d8cdaecfe2..9459bc78d6 100644 --- a/awx/main/models/rbac.py +++ b/awx/main/models/rbac.py @@ -84,6 +84,9 @@ class Role(CommonModelNameNotUnique): ret.save() return ret + def is_ancestor_of(self, role): + return RoleHierarchy.objects.filter(role_id=role.id, ancestor_id=self.id).count() > 0 + class RoleHierarchy(CreatedModifiedModel):