plug SAML
[auf_rh_dae.git] / project / urls.py
index 5334386..dd06a52 100644 (file)
@@ -4,6 +4,7 @@ from django.contrib import admin
 from urldecorators.defaults import patterns, include, url
 from urldecorators.defaults import handler500  # NOQA
 from auf.django import permissions
+from auf.django.saml import settings as saml_settings
 from project.monkey import patch_ajax_selects
 
 patch_ajax_selects()
@@ -13,28 +14,43 @@ permissions.autodiscover()
 
 urlpatterns = patterns(
     '',
-    url(r'^$', 'project.views.index', name='index'),
-    url(r'^admin_tools/', include('admin_tools.urls')),
+    url(r'^$', 'project.views.index', name='index',
+        decorators=['auf.django.saml.decorators.login_required']),
+
+    url(r'^', include('auf.django.saml.urls')),
+
+    url(r'^admin_tools/', include('admin_tools.urls'),
+        decorators=['auf.django.saml.decorators.login_required']),
     (r'^admin/', include(admin.site.urls)),
+
     url(r'^api/(?P<method>[a-z_-]+)/(?P<offre_id>\d+)/$',
         'project.recrutement.api.api', name='recrutement_api'),
     url(r'^api/(?P<method>[a-z_-]+)/$', 'project.recrutement.api.api',
         name='recrutement_api'),
-    (r'^connexion/$', 'django.contrib.auth.views.login'),
-    (r'^deconnexion/$', 'django.contrib.auth.views.logout'),
-    #url(r'^private_files/', include('private_files.urls')),
-    url(r'^captcha/', include('captcha.urls')),
-    (r'^ajax_select/', include('ajax_select.urls')),
-    (r'^tinymce/', include('tinymce.urls')),
-    url(r'^prive/(?P<filename>.*)$', 'project.views.piece'),
+
+    url(r'^captcha/', include('captcha.urls'),
+        decorators=['auf.django.saml.decorators.login_required']),
+    url(r'^ajax_select/', include('ajax_select.urls'),
+        decorators=['auf.django.saml.decorators.login_required']),
+    url(r'^tinymce/', include('tinymce.urls'),
+        decorators=['auf.django.saml.decorators.login_required']),
+    url(r'^prive/(?P<filename>.*)$', 'project.views.piece',
+        decorators=['auf.django.saml.decorators.login_required']),
 
     # apps
     url(r'^dae/', include('project.dae.urls'),
-        decorators=['django.contrib.auth.decorators.login_required']),
+        decorators=['auf.django.saml.decorators.login_required']),
     url(r'^recrutement/', include('project.recrutement.urls'),
-        decorators=['django.contrib.auth.decorators.login_required']),
+        decorators=['auf.django.saml.decorators.login_required']),
     url(r'^rh/', include('project.rh.urls'),
-        decorators=['django.contrib.auth.decorators.login_required']),
+        decorators=['auf.django.saml.decorators.login_required']),
 
-    url(r'^qbe/', include('django_qbe.urls')),
+    url(r'^qbe/', include('django_qbe.urls'),
+        decorators=['auf.django.saml.decorators.login_required']),
 )
+
+if not saml_settings.SAML_AUTH:
+    urlpatterns += patterns(
+        '',
+        (r'^', include('auf.django.saml.mellon_urls')),
+    )