mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Fixed permissions on stats
This commit is contained in:
parent
f22f2cbde6
commit
f7722ed564
@ -695,7 +695,7 @@ class CounterActivityView(DetailView):
|
|||||||
pk_url_kwarg = "counter_id"
|
pk_url_kwarg = "counter_id"
|
||||||
template_name = 'counter/activity.jinja'
|
template_name = 'counter/activity.jinja'
|
||||||
|
|
||||||
class CounterStatView(DetailView):
|
class CounterStatView(DetailView, CanEditMixin):
|
||||||
"""
|
"""
|
||||||
Show the bar stats
|
Show the bar stats
|
||||||
"""
|
"""
|
||||||
@ -725,13 +725,15 @@ class CounterStatView(DetailView):
|
|||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
res = super(CounterStatView, self).dispatch(request, *args, **kwargs)
|
try:
|
||||||
# help(self.object)
|
return super(CounterStatView, self).dispatch(request, *args, **kwargs)
|
||||||
if (request.user.is_root
|
except:
|
||||||
or request.user.is_board_member
|
try:
|
||||||
or self.object.is_owned_by(request.user)
|
if (request.user.is_root
|
||||||
):
|
or request.user.is_board_member
|
||||||
return res
|
or self.object.is_owned_by(request.user)):
|
||||||
|
return super(CanEditMixin, self).dispatch(request, *args, **kwargs)
|
||||||
|
except:pass
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user