# Fixes Permission check order
* fixes bug where permissions would be checked on non-logged in users which caused errors
This commit is contained in:
@@ -3,6 +3,8 @@ Author: Michel Peltriaux
|
||||
Created on: 14.12.25
|
||||
|
||||
"""
|
||||
from abc import ABC
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpRequest, JsonResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
@@ -12,16 +14,10 @@ from konova.decorators import default_group_required
|
||||
from konova.utils.generators import IdentifierGenerator
|
||||
|
||||
|
||||
class AbstractIdentifierGeneratorView(LoginRequiredMixin, View):
|
||||
class AbstractIdentifierGeneratorView(LoginRequiredMixin, View, ABC):
|
||||
_MODEL = None
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
@method_decorator(default_group_required)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get(self, request: HttpRequest, *args, **kwargs):
|
||||
generator = IdentifierGenerator(model=self._MODEL)
|
||||
identifier = generator.generate_id()
|
||||
|
||||
Reference in New Issue
Block a user