add minimalistic login requirements around a few URLs
Permission management will have to be discussed.
This commit is contained in:
parent
aa4d203702
commit
bdce2a3e99
|
@ -16,6 +16,7 @@
|
|||
|
||||
import json
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.template import RequestContext
|
||||
|
@ -64,7 +65,7 @@ class Dgs(TemplateView):
|
|||
assoc.push(request, context=context)
|
||||
return HttpResponseRedirect(reverse('alfortville-dgs'))
|
||||
|
||||
dgs = Dgs.as_view()
|
||||
dgs = login_required(Dgs.as_view())
|
||||
|
||||
|
||||
class Copies(DetailView):
|
||||
|
@ -97,7 +98,7 @@ class Copies(DetailView):
|
|||
Inbox.objects.get_or_create(qualif_id=kwargs['pk'], role_slug=avis, subtype=Inbox.AVIS)
|
||||
return HttpResponseRedirect('.')
|
||||
|
||||
copies = Copies.as_view()
|
||||
copies = login_required(Copies.as_view())
|
||||
|
||||
|
||||
def copies_ajax(request, *args, **kwargs):
|
||||
|
@ -148,11 +149,11 @@ class TableAvis(MailTable):
|
|||
subtype = Inbox.AVIS
|
||||
title = _('Avis Copies')
|
||||
|
||||
table_avis = TableAvis.as_view()
|
||||
table_avis = login_required(TableAvis.as_view())
|
||||
|
||||
|
||||
class TableInfo(MailTable):
|
||||
subtype = Inbox.INFO
|
||||
title = _('Info Copies')
|
||||
|
||||
table_info = TableInfo.as_view()
|
||||
table_info = login_required(TableInfo.as_view())
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
{% block page-title %}Welco{% endblock %}
|
||||
{% block site-title %}Welco{% endblock %}
|
||||
{% block logout-url %}{% url 'auth_logout' %}{% endblock %}
|
||||
|
||||
{% block extrascripts %}
|
||||
{{ block.super }}
|
||||
|
|
|
@ -18,6 +18,7 @@ from django.conf.urls import patterns, include, url
|
|||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
from . import apps
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import json
|
||||
import urllib
|
||||
|
||||
from django.contrib.auth import logout as auth_logout
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
|
@ -106,13 +108,13 @@ class Home(TemplateView):
|
|||
context['contacts'] = ContactsHomeZone(self.request)
|
||||
return context
|
||||
|
||||
home = Home.as_view()
|
||||
home = login_required(Home.as_view())
|
||||
|
||||
|
||||
class HomePhone(Home):
|
||||
source_klass = PhoneHome
|
||||
|
||||
home_phone = HomePhone.as_view()
|
||||
home_phone = login_required(HomePhone.as_view())
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
|
|
Loading…
Reference in New Issue