Add permission check to AccountStatBalance

Only connected user can get its balance data
This commit is contained in:
Aurélien Delobelle 2017-04-02 17:14:36 +02:00
parent 87b9db520f
commit 1ee993e1e1

View file

@ -2260,6 +2260,12 @@ class AccountStatBalance(PkUrlMixin, JSONDetailView):
# TODO: offset
return context
def get_object(self, *args, **kwargs):
obj = super().get_object(*args, **kwargs)
if self.request.user != obj.user:
raise PermissionDenied
return obj
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(AccountStatBalance, self).dispatch(*args, **kwargs)