if groups.CORRESPONDANT_RH in user_groups or \
groups.ADMINISTRATEURS in user_groups or \
groups.DIRECTEUR_DE_BUREAU in user_groups:
- employe = groups.get_employe_from_user(request.user)
- q = Q(**{
- model.prefix_implantation: employe.implantation.region
- })
+ zones = groups.get_zones_from_user(request.user)
+ qkey = '%s__in' % model.prefix_implantation
+ q = Q(**{ qkey: zones })
qs = model.objects.filter(q)
if int(id) in [o.id for o in qs]:
return func(request, id)
return redirect_interdiction(request)
return wrapped
return wrapper
-
+
+
def in_one_of_group(groups):
"""
Test si le user appartient au moins 1 des ces groupes