def remove_backdoor(request, id_): """ Remove a Backdoor. :param request: Django request. :type request: :class:`django.http.HttpRequest` :param id_: The ObjectId of the Backdoor to remove. :type id_: str :returns: :class:`django.http.HttpResponse` """ if request.method == "POST": request.user._setup() user = request.user if user.has_access_to(BackdoorACL.DELETE): backdoor_remove(id_, user.username) return HttpResponseRedirect( reverse('crits-backdoors-views-backdoors_listing')) return render(request, 'error.html', {'error': 'Expected AJAX/POST'})
def remove_backdoor(request, id_): """ Remove a Backdoor. :param request: Django request. :type request: :class:`django.http.HttpRequest` :param id_: The ObjectId of the Backdoor to remove. :type id_: str :returns: :class:`django.http.HttpResponse` """ if request.method == "POST": if is_admin(request.user): backdoor_remove(id_, request.user.username) return HttpResponseRedirect( reverse('crits.backdoors.views.backdoors_listing')) error = 'You do not have permission to remove this item.' return render_to_response("error.html", {'error': error}, RequestContext(request)) return render_to_response('error.html', {'error': 'Expected AJAX/POST'}, RequestContext(request))
def remove_backdoor(request, id_): """ Remove a Backdoor. :param request: Django request. :type request: :class:`django.http.HttpRequest` :param id_: The ObjectId of the Backdoor to remove. :type id_: str :returns: :class:`django.http.HttpResponse` """ if request.method == "POST": if is_admin(request.user): backdoor_remove(id_, request.user.username) return HttpResponseRedirect(reverse('crits.backdoors.views.backdoors_listing')) error = 'You do not have permission to remove this item.' return render_to_response("error.html", {'error': error}, RequestContext(request)) return render_to_response('error.html', {'error':'Expected AJAX/POST'}, RequestContext(request))