Commit 3324ab02 by Bridger Maxwell

Added a permission denied page.

parent 8cd2bb7b
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf import settings as django_settings from django.conf import settings as django_settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.shortcuts import redirect, get_object_or_404 from django.shortcuts import redirect, get_object_or_404, render_to_response
from django.template.context import RequestContext
from django.http import HttpResponse, HttpResponseNotFound from django.http import HttpResponse, HttpResponseNotFound
from django.utils import simplejson as json from django.utils import simplejson as json
...@@ -81,15 +82,17 @@ def get_article(func=None, can_read=True, can_write=False, deleted_contents=Fals ...@@ -81,15 +82,17 @@ def get_article(func=None, can_read=True, can_write=False, deleted_contents=Fals
if request.user.is_anonymous(): if request.user.is_anonymous():
return redirect(django_settings.LOGIN_URL) return redirect(django_settings.LOGIN_URL)
else: else:
c = RequestContext(request, {'urlpath' : urlpath})
return render_to_response("wiki/permission_denied.html", context_instance=c)
pass pass
# TODO: Return a permission denied page
if can_write and not article.can_write(request.user): if can_write and not article.can_write(request.user):
if request.user.is_anonymous(): if request.user.is_anonymous():
return redirect(django_settings.LOGIN_URL) return redirect(django_settings.LOGIN_URL)
else: else:
c = RequestContext(request, {'urlpath' : urlpath})
return render_to_response("wiki/permission_denied.html", context_instance=c)
pass pass
# TODO: Return a permission denied page
# If the article has been deleted, show a special page. # If the article has been deleted, show a special page.
if not deleted_contents and article.current_revision and article.current_revision.deleted: if not deleted_contents and article.current_revision and article.current_revision.deleted:
......
{% extends "wiki/base.html" %}
{% load wiki_tags i18n %}
{% load url from future %}
{% block pagetitle %}Permission Denied{% endblock %}
{% block wiki_contents %}
<h1>Permission Denied</h2>
<p>Sorry, you don't have permission to view this page.</p>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment