from django.shortcuts import redirect

class LibrarianRequiredMixin:
    def dispatch(self, request, *args, **kwargs):
        # Gantilah dengan mekanisme otentikasi sesuai kebutuhan Anda
        if request.user.is_authenticated and request.user.is_librarian == True:
            return super().dispatch(request, *args, **kwargs)
        else:
            return redirect('unauthorized')
