1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 05:25:29 +03:00

Added Role.is_ancestor_of predicate

This commit is contained in:
Akita Noek 2016-02-05 16:58:16 -05:00
parent 4540eb0079
commit 332b8b3b49

View File

@ -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):