provisionning: get all roles (#19516)
This commit is contained in:
parent
c448546dbe
commit
858521f6c4
|
@ -147,12 +147,11 @@ class Provisionning(threading.local):
|
|||
.filter(attributes__name='is_superuser')
|
||||
.exists())
|
||||
|
||||
all_roles = (Role.objects.filter(members__in=users).parents()
|
||||
.prefetch_related('attributes').distinct())
|
||||
all_roles = Role.objects.all().prefetch_related('attributes')
|
||||
roles = dict((r.id, r) for r in all_roles)
|
||||
user_roles = {}
|
||||
parents = {}
|
||||
for rp in RoleParenting.objects.filter(child__in=all_roles):
|
||||
for rp in RoleParenting.objects.all():
|
||||
parents.setdefault(rp.child.id, []).append(rp.parent.id)
|
||||
Through = Role.members.through
|
||||
qs = Through.objects.filter(role__members__in=users).values_list('user_id', 'role_id')
|
||||
|
|
Loading…
Reference in New Issue