Projet

Général

Profil

0001-attributes_ng-sources-service_roles-source-does-not-.patch

Benjamin Dauvergne, 11 juin 2015 17:33

Télécharger (1,31 ko)

Voir les différences:

Subject: [PATCH] attributes_ng/sources: service_roles source does not get
 inherited service roles (fixes #7546)

The call to filter(service=service) must be done after the call to
for_user(user), otherwise we only get inherited roles of services roles,
which means none.
 src/authentic2/attributes_ng/sources/service_roles.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
src/authentic2/attributes_ng/sources/service_roles.py
38 38
    if not user or not service:
39 39
        return
40 40
    ctx = ctx.copy()
41
    roles = Role.objects.filter(service=service) \
42
        .for_user(user).prefetch_related('attributes')
41
    roles = Role.objects.for_user(user) \
42
        .filter(service=service) \
43
        .prefetch_related('attributes')
43 44
    for service_role in roles:
44 45
        for service_role_attribute in service_role.attributes.all():
45 46
            name = service_role_attribute.name
46
-