mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-21 21:53:30 +00:00
Only club members can view counter's stats
This commit is contained in:
parent
24d744ee9c
commit
f22f2cbde6
@ -4,6 +4,7 @@ from django.views.generic.edit import UpdateView, CreateView, DeleteView, Proces
|
||||
from django.forms.models import modelform_factory
|
||||
from django.forms import CheckboxSelectMultiple
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils import timezone
|
||||
from django import forms
|
||||
@ -723,6 +724,16 @@ class CounterStatView(DetailView):
|
||||
).exclude(selling_sum=None).order_by('-selling_sum').all()[:100]
|
||||
return kwargs
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
res = super(CounterStatView, self).dispatch(request, *args, **kwargs)
|
||||
# help(self.object)
|
||||
if (request.user.is_root
|
||||
or request.user.is_board_member
|
||||
or self.object.is_owned_by(request.user)
|
||||
):
|
||||
return res
|
||||
raise PermissionDenied
|
||||
|
||||
|
||||
class CashSummaryListView(CanEditPropMixin, CounterTabsMixin, ListView):
|
||||
"""Display a list of cash summaries"""
|
||||
|
Loading…
Reference in New Issue
Block a user