Commit 69cf4530 by Guba Sándor

views/node: add get function to properly return 403 on unathorized

access
parent 8316fe03
...@@ -82,9 +82,12 @@ class NodeDetailView(LoginRequiredMixin, ...@@ -82,9 +82,12 @@ class NodeDetailView(LoginRequiredMixin,
form = None form = None
form_class = TraitForm form_class = TraitForm
def get_context_data(self, form=None, **kwargs): def get(self, *args, **kwargs):
if not self.request.user.has_perm('vm.view_statistics'): if not self.request.user.has_perm('vm.view_statistics'):
raise PermissionDenied() raise PermissionDenied()
return super(NodeDetailView, self).get(*args, **kwargs)
def get_context_data(self, form=None, **kwargs):
if form is None: if form is None:
form = self.form_class() form = self.form_class()
context = super(NodeDetailView, self).get_context_data(**kwargs) context = super(NodeDetailView, self).get_context_data(**kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment