def wrapper(*args, **kwargs): request = args[0] user_id = kwargs['user_id'] if not ticketMatchesUser(request, user_id): return HttpResponseForbidden( "The ticket doesn't match the given user\n" + "Given Ticket: \"" + request.META[DJANGO_TICKET_HEADER] + "\"\n" + "Given User id: \"" + user_id + "\"") else: return function(*args, **kwargs)
def wrapper(*args, **kwargs): request = args[0] user_id = kwargs['user_id'] event_id = kwargs['event_id'] event = Event.objects.get(event_id__id=event_id) if ticketMatchesUser(args[0], user_id): return function(*args, **kwargs) elif event.host.id == user_id: return function(*args, **kwargs) else: return HttpResponseForbidden("only the host or user may do that")
def wrapper(*args, **kwargs): request = args[0] user_id = kwargs['user_id'] if getDjangoTicketHeader() not in request.META: responseString = "Must provide the " + getTicketHeader() + " header. " return HttpResponseBadRequest(responseString) elif not isValidTicket(request.META[getDjangoTicketHeader()]): return HttpResponseForbidden("Invalid ticket") elif not ticketMatchesUser(request, user_id): return HttpResponseForbidden() else: return function(*args, **kwargs)
def wrapper(*args, **kwargs): request = args[0] user_id = kwargs["user_id"] if not ticketMatchesUser(request, user_id): return HttpResponseForbidden( "The ticket doesn't match the given user\n" + 'Given Ticket: "' + request.META[DJANGO_TICKET_HEADER] + '"\n' + 'Given User id: "' + user_id + '"' ) else: return function(*args, **kwargs)
def wrapper(*args, **kwargs): request = args[0] user_id = kwargs['user_id'] if getDjangoTicketHeader() not in request.META: responseString = "Must provide the " + getTicketHeader() + " header. " return HttpResponseBadRequest(responseString) elif not isValidTicket( request.META[getDjangoTicketHeader()], request.META['REMOTE_ADDR']): return HttpResponseForbidden("Invalid ticket: \"" + request.META[getDjangoTicketHeader()] + "\"") elif not ticketMatchesUser(request, user_id): return HttpResponseForbidden("The ticket doesn't match the given user\n" + "Give Ticket: \"" + request.META[getDjangoTicketHeader()] + "\"\n" + "Given User id: \"" + user_id + "\"") else: return function(*args, **kwargs)