Move permission check
This commit is contained in:
parent
100686457b
commit
b2a5dfd682
1 changed files with 4 additions and 3 deletions
|
@ -1470,6 +1470,10 @@ def history_json(request):
|
|||
accounts = request.GET.getlist('accounts[]', None)
|
||||
transfers_only = request.GET.get('transfersonly', None)
|
||||
|
||||
# Un non-membre de l'équipe n'a que accès à son historique
|
||||
if not request.user.has_perm('kfet.is_team'):
|
||||
accounts = [request.user.profile.account]
|
||||
|
||||
# Construction de la requête (sur les opérations) pour le prefetch
|
||||
ope_queryset_prefetch = Operation.objects.select_related(
|
||||
'canceled_by', 'addcost_for',
|
||||
|
@ -1524,9 +1528,6 @@ def history_json(request):
|
|||
opegroups = OperationGroup.objects.none()
|
||||
if accounts:
|
||||
opegroups = opegroups.filter(on_acc_id__in=accounts)
|
||||
# Un non-membre de l'équipe n'a que accès à son historique
|
||||
if not request.user.has_perm('kfet.is_team'):
|
||||
opegroups = opegroups.filter(on_acc=request.user.profile.account_kfet)
|
||||
|
||||
# Construction de la réponse
|
||||
related_data = defaultdict(list)
|
||||
|
|
Loading…
Reference in a new issue