From: Radek Czajka Date: Wed, 31 Oct 2012 09:29:23 +0000 (+0100) Subject: cas X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/52135b64e35cca4cae8fab7446480a1feab3e50e?ds=inline;hp=--cc cas --- 52135b64e35cca4cae8fab7446480a1feab3e50e diff --git a/prawokultury/settings.d/30-apps.conf b/prawokultury/settings.d/30-apps.conf index 5aa5144..8d6bf16 100755 --- a/prawokultury/settings.d/30-apps.conf +++ b/prawokultury/settings.d/30-apps.conf @@ -12,6 +12,7 @@ INSTALLED_APPS = ( 'pagination', 'sorl.thumbnail', 'piwik.django', + 'django_cas', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/prawokultury/settings.d/40-auth.conf b/prawokultury/settings.d/40-auth.conf new file mode 100755 index 0000000..675db9d --- /dev/null +++ b/prawokultury/settings.d/40-auth.conf @@ -0,0 +1,5 @@ +if 'django_cas' in INSTALLED_APPS: + AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'django_cas.backends.CASBackend', + ) diff --git a/prawokultury/settings.d/40-middleware.conf b/prawokultury/settings.d/40-middleware.conf index eedc50e..2b07632 100755 --- a/prawokultury/settings.d/40-middleware.conf +++ b/prawokultury/settings.d/40-middleware.conf @@ -6,6 +6,14 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', +) + +if 'django_cas' in INSTALLED_APPS: + MIDDLEWARE_CLASSES += ( + 'django_cas.middleware.CASMiddleware', + ) + +MIDDLEWARE_CLASSES += ( 'django.contrib.messages.middleware.MessageMiddleware', 'piwik.django.middleware.PiwikMiddleware', # Uncomment the next line for simple clickjacking protection: @@ -13,3 +21,5 @@ MIDDLEWARE_CLASSES = ( 'pagination.middleware.PaginationMiddleware', 'realip_middleware.SetRemoteAddrFromXRealIP', ) + + diff --git a/prawokultury/settings.d/50-contrib.conf b/prawokultury/settings.d/50-contrib.conf index 12d387e..27a516c 100755 --- a/prawokultury/settings.d/50-contrib.conf +++ b/prawokultury/settings.d/50-contrib.conf @@ -12,3 +12,6 @@ COMMENTS_XTD_LIST_URL_ACTIVE = True THUMBNAIL_QUALITY = 95 GRAVATAR_DEFAULT_IMAGE = 'http://localhost:8000/static/img/avatar.png' + +CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/' +CAS_VERSION = '1' diff --git a/prawokultury/urls.py b/prawokultury/urls.py index 4db309c..e1fb40b 100644 --- a/prawokultury/urls.py +++ b/prawokultury/urls.py @@ -19,7 +19,15 @@ urlpatterns = patterns('', url(r'^media/(?P.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, }), -) + i18n_patterns('', + ) + +if 'django_cas' in settings.INSTALLED_APPS: + urlpatterns += patterns('', + (r'^accounts/login/$', 'django_cas.views.login'), + (r'^accounts/logout/$', 'django_cas.views.logout'), + ) + +urlpatterns += i18n_patterns('', url(string_concat(r'^', _('events'), r'/'), include('events.urls')), url(r'^comments/', include('django_comments_xtd.urls')), ) + migdal_urlpatterns diff --git a/requirements.txt b/requirements.txt index eb707fd..79359e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ Django>=1.4,<1.5 +#django_cas +-e hg+https://bitbucket.org/cpcc/django-cas@197f156ee943#egg=django_cas South>=0.7.4 PIL sorl-thumbnail>=11.09,<12