def _logout(self, request): from hijack.helpers import release_hijack # Release masquerade on logout if masquerading try: release_hijack(request) except PermissionDenied: # Means we are not hijacked super()._logout(request)
def post(self, request, *args, **kwargs): impersonated = request.user release_hijack(request) request.user.log_action('pretix.control.auth.user.impersonate_stopped', user=request.user, data={ 'other': impersonated.pk, 'other_email': impersonated.email }) return redirect(reverse('control:index'))
def endmasquerade(self, request): from hijack.helpers import release_hijack if request.method != 'POST': raise BinderMethodNotAllowed() self._require_model_perm('unmasquerade', request) release_hijack(request) # Ignore returned redirect response object return self.respond_with_user(request, request.user.id)
def post(self, request, *args, **kwargs): impersonated = request.user hijs = request.session['hijacker_session'] release_hijack(request) ss = request.user.get_active_staff_session(hijs) if ss: request.session.save() ss.session_key = request.session.session_key ss.save() request.user.log_action('pretix.control.auth.user.impersonate_stopped', user=request.user, data={ 'other': impersonated.pk, 'other_email': impersonated.email }) return redirect(reverse('control:index'))
def end_su(request): return hijack.release_hijack(request)