diff --git a/authentic2_auth_saml2/templates/rest_framework/api.html b/authentic2_auth_saml2/templates/rest_framework/api.html deleted file mode 100644 index 9c44916..0000000 --- a/authentic2_auth_saml2/templates/rest_framework/api.html +++ /dev/null @@ -1 +0,0 @@ -{% extends "rest_framework/base.html" %} diff --git a/setup.py b/setup.py index 7253467..2151bf5 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def get_version(): import os version = None - for d in glob.glob('*'): + for d in glob.glob('src/*'): if not os.path.isdir(d): continue module_file = os.path.join(d, '__init__.py') @@ -38,8 +38,23 @@ setup(name='authentic2-auth-saml2', description='Authentic2 Auth SAML2', author="Entr'ouvert", author_email="info@entrouvert.com", - packages=find_packages(os.path.dirname(__file__) or '.'), - install_requires=[], + packages=find_packages('src'), + package_dir={ + '': 'src', + }, + install_requires=[ + 'django-mellon', + ], + package_data={ + 'authentic2_auth_saml2': [ + 'templates/authsaml2/*.html', + 'locale/fr/LC_MESSAGES/django.po', + 'locale/fr/LC_MESSAGES/django.mo', + 'static/authentic2_auth_kerberos/js/*.js', + 'static/authentic2_auth_kerberos/css/*.css', + 'static/authentic2_auth_kerberos/img/*.png', + ], + }, entry_points={ 'authentic2.plugin': [ 'authentic-auth-saml2 = authentic2_auth_saml2:Plugin', diff --git a/authentic2_auth_saml2/__init__.py b/src/authentic2_auth_saml2/__init__.py similarity index 100% rename from authentic2_auth_saml2/__init__.py rename to src/authentic2_auth_saml2/__init__.py diff --git a/authentic2_auth_saml2/app_settings.py b/src/authentic2_auth_saml2/app_settings.py similarity index 100% rename from authentic2_auth_saml2/app_settings.py rename to src/authentic2_auth_saml2/app_settings.py diff --git a/authentic2_auth_saml2/backends.py b/src/authentic2_auth_saml2/backends.py similarity index 100% rename from authentic2_auth_saml2/backends.py rename to src/authentic2_auth_saml2/backends.py diff --git a/authentic2_auth_saml2/decorators.py b/src/authentic2_auth_saml2/decorators.py similarity index 100% rename from authentic2_auth_saml2/decorators.py rename to src/authentic2_auth_saml2/decorators.py diff --git a/authentic2_auth_saml2/forms.py b/src/authentic2_auth_saml2/forms.py similarity index 100% rename from authentic2_auth_saml2/forms.py rename to src/authentic2_auth_saml2/forms.py diff --git a/authentic2_auth_saml2/frontend.py b/src/authentic2_auth_saml2/frontend.py similarity index 100% rename from authentic2_auth_saml2/frontend.py rename to src/authentic2_auth_saml2/frontend.py diff --git a/authentic2_auth_saml2/locale/fr/LC_MESSAGES/django.po b/src/authentic2_auth_saml2/locale/fr/LC_MESSAGES/django.po similarity index 100% rename from authentic2_auth_saml2/locale/fr/LC_MESSAGES/django.po rename to src/authentic2_auth_saml2/locale/fr/LC_MESSAGES/django.po diff --git a/authentic2_auth_saml2/migrations/__init__.py b/src/authentic2_auth_saml2/migrations/__init__.py similarity index 100% rename from authentic2_auth_saml2/migrations/__init__.py rename to src/authentic2_auth_saml2/migrations/__init__.py diff --git a/authentic2_auth_saml2/signals.py b/src/authentic2_auth_saml2/signals.py similarity index 100% rename from authentic2_auth_saml2/signals.py rename to src/authentic2_auth_saml2/signals.py diff --git a/authentic2_auth_saml2/templates/authsaml2/account_linking.html b/src/authentic2_auth_saml2/templates/authsaml2/account_linking.html similarity index 100% rename from authentic2_auth_saml2/templates/authsaml2/account_linking.html rename to src/authentic2_auth_saml2/templates/authsaml2/account_linking.html diff --git a/authentic2_auth_saml2/templates/authsaml2/error_authsaml2.html b/src/authentic2_auth_saml2/templates/authsaml2/error_authsaml2.html similarity index 100% rename from authentic2_auth_saml2/templates/authsaml2/error_authsaml2.html rename to src/authentic2_auth_saml2/templates/authsaml2/error_authsaml2.html diff --git a/authentic2_auth_saml2/templates/authsaml2/login_form.html b/src/authentic2_auth_saml2/templates/authsaml2/login_form.html similarity index 100% rename from authentic2_auth_saml2/templates/authsaml2/login_form.html rename to src/authentic2_auth_saml2/templates/authsaml2/login_form.html diff --git a/authentic2_auth_saml2/templates/authsaml2/profile.html b/src/authentic2_auth_saml2/templates/authsaml2/profile.html similarity index 100% rename from authentic2_auth_saml2/templates/authsaml2/profile.html rename to src/authentic2_auth_saml2/templates/authsaml2/profile.html diff --git a/authentic2_auth_saml2/transient.py b/src/authentic2_auth_saml2/transient.py similarity index 88% rename from authentic2_auth_saml2/transient.py rename to src/authentic2_auth_saml2/transient.py index 24672e9..516b6fd 100644 --- a/authentic2_auth_saml2/transient.py +++ b/src/authentic2_auth_saml2/transient.py @@ -1,7 +1,7 @@ -from django.db import models +import django from django.utils.translation import ugettext_lazy as _ from django.db.models.manager import EmptyManager -from django.contrib.auth.models import _user_get_all_permissions, _user_has_perm, _user_has_module_perms +from django.contrib.auth.models import _user_get_all_permissions, _user_has_perm, _user_has_module_perms, Group, Permission class FakePk: @@ -19,8 +19,12 @@ class SAML2TransientUser(object): is_staff = False is_active = False is_superuser = False - _groups = EmptyManager() - _user_permissions = EmptyManager() + if django.VERSION >= (1, 6, 0): + _groups = EmptyManager(Group) + _user_permissions = EmptyManager(Permission) + else: + _groups = EmptyManager() + _user_permissions = EmptyManager() _meta = FakeMeta() def __init__(self, id): diff --git a/authentic2_auth_saml2/urls.py b/src/authentic2_auth_saml2/urls.py similarity index 100% rename from authentic2_auth_saml2/urls.py rename to src/authentic2_auth_saml2/urls.py diff --git a/authentic2_auth_saml2/utils.py b/src/authentic2_auth_saml2/utils.py similarity index 100% rename from authentic2_auth_saml2/utils.py rename to src/authentic2_auth_saml2/utils.py diff --git a/authentic2_auth_saml2/views.py b/src/authentic2_auth_saml2/views.py similarity index 99% rename from authentic2_auth_saml2/views.py rename to src/authentic2_auth_saml2/views.py index 5a309d8..2e5f1fb 100644 --- a/authentic2_auth_saml2/views.py +++ b/src/authentic2_auth_saml2/views.py @@ -655,7 +655,7 @@ def get_provider_id_and_options(provider_id): if not provider_id: provider_id = reverse('a2-auth-saml2-metadata') options = metadata_options - options.update(app_settings.AUTHSAML2_METADATA_OPTIONS) + options.update(app_settings.METADATA_OPTIONS) return provider_id, options def get_metadata(request, provider_id=None): diff --git a/authentic2_auth_saml2/views_disco.py b/src/authentic2_auth_saml2/views_disco.py similarity index 100% rename from authentic2_auth_saml2/views_disco.py rename to src/authentic2_auth_saml2/views_disco.py diff --git a/authentic2_auth_saml2/views_profile.py b/src/authentic2_auth_saml2/views_profile.py similarity index 100% rename from authentic2_auth_saml2/views_profile.py rename to src/authentic2_auth_saml2/views_profile.py