diff --git a/ulakbus/models/auth.py b/ulakbus/models/auth.py index 3dae7749..d8dbb4e0 100644 --- a/ulakbus/models/auth.py +++ b/ulakbus/models/auth.py @@ -97,12 +97,11 @@ def get_permitted_users(self): User list """ users = set() - for ars in self.abstract_role_set: - for r in ars.abstract_role.role_set: - users.add(r.role.user) - for r in self.role_set: - users.add(r.role.user) - + for ars in self.abstract_role_set.objects.filter(): + for r in ars.role_set.objects.filter(): + users.add(r.user) + for r in self.role_set.objects.filter(): + users.add(r.user) return users def get_permitted_roles(self): @@ -113,11 +112,11 @@ def get_permitted_roles(self): Role list """ roles = set() - for ars in self.abstract_role_set: - for r in ars.abstract_role.role_set: - roles.add(r.role) - for r in self.role_set: - roles.add(r.role) + for ars in self.abstract_role_set.objects.filter(): + for r in ars.role_set.objects.filter(): + roles.add(r) + for r in self.role_set.objects.filter(): + roles.add(r) return roles