Projet

Général

Profil

0001-attributes_ng-limit-service-roles-depending-on-auth-.patch

Valentin Deniaud, 24 avril 2019 11:48

Télécharger (1,1 ko)

Voir les différences:

Subject: [PATCH] attributes_ng: limit service roles depending on auth level

 src/authentic2/attributes_ng/sources/service_roles.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/authentic2/attributes_ng/sources/service_roles.py
38 38
    if not user or not service:
39 39
        return ctx
40 40
    ctx = ctx.copy()
41
    user_auth_level = ctx['request'].session.get('auth_level', 1)
41 42
    roles = Role.objects.for_user(user) \
42
        .filter(service=service) \
43
        .filter(service=service, auth_level__lte=user_auth_level) \
43 44
        .prefetch_related('attributes')
44 45
    for service_role in roles:
45 46
        for service_role_attribute in service_role.attributes.all():
46
-