Example #1
0
	def _wrapped_view(request, *args, **kwargs):
		if request.user.is_authenticated():
			return function(request, *args, **kwargs)
		return render_to_json_response({'status': {'code': 401, 'text': 'login required'}})
Example #2
0
	def _wrapped_view(request, *args, **kwargs):
		if request.user.is_authenticated() and request.user.get_profile().get_level() == 'admin':
			return function(request, *args, **kwargs)
		return render_to_json_response({'status': {'code': 403, 'text': 'permission denied'}})
Example #3
0
 def process_exception(self, request, exception):
     if isinstance(exception, HttpErrorJson):     
         return render_to_json_response(exception.response)          
     return None