misc: apply isort (#52457)

This commit is contained in:
Valentin Deniaud 2021-03-30 10:38:14 +02:00
parent 3dc618a571
commit 86d946adcd
310 changed files with 1245 additions and 1370 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import sys import sys
import authentic2.logger import authentic2.logger
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,6 +1,7 @@
import glob import glob
import os import os
import warnings import warnings
from authentic2 import logger from authentic2 import logger
ETC_DIR = '/etc/authentic2/' ETC_DIR = '/etc/authentic2/'
@ -123,6 +124,7 @@ A2_OPENED_SESSION_COOKIE_SECURE = True
# Old settings method # Old settings method
def extract_settings_from_environ(): def extract_settings_from_environ():
import json import json
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
global MANAGERS, DATABASES, SENTRY_TRANSPORT, SENTRY_DSN, INSTALLED_APPS, SECURE_PROXY_SSL_HEADER, CACHES, SESSION_ENGINE, LDAP_AUTH_SETTINGS global MANAGERS, DATABASES, SENTRY_TRANSPORT, SENTRY_DSN, INSTALLED_APPS, SECURE_PROXY_SSL_HEADER, CACHES, SESSION_ENGINE, LDAP_AUTH_SETTINGS

View File

@ -1,4 +1,5 @@
import os import os
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
# Debian defaults # Debian defaults

View File

@ -11,7 +11,8 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import sys, os import os
import sys
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the

View File

@ -1,13 +1,13 @@
#!/usr/bin/python #!/usr/bin/python
from __future__ import print_function from __future__ import print_function
import sys
import os
import xml.etree.ElementTree as ET
import logging import logging
import os
import re import re
from shutil import copyfile import sys
import xml.etree.ElementTree as ET
from optparse import OptionParser from optparse import OptionParser
from shutil import copyfile
### This file came from the https://github.com/flow123d/flow123d repo they were nice enough to spend time to write this. ### This file came from the https://github.com/flow123d/flow123d repo they were nice enough to spend time to write this.
### It is copied here for other people to use on its own. ### It is copied here for other people to use on its own.

View File

@ -4,16 +4,16 @@
Setup script for Authentic 2 Setup script for Authentic 2
''' '''
import glob
import os
import subprocess import subprocess
import sys import sys
import os from distutils.cmd import Command
import glob from distutils.command.build import build as _build
from setuptools import setup, find_packages from setuptools import find_packages, setup
from setuptools.command.install_lib import install_lib as _install_lib from setuptools.command.install_lib import install_lib as _install_lib
from setuptools.command.sdist import sdist as _sdist from setuptools.command.sdist import sdist as _sdist
from distutils.command.build import build as _build
from distutils.cmd import Command
class compile_translations(Command): class compile_translations(Command):

View File

@ -19,9 +19,10 @@ import django
default_app_config = 'authentic2.app.Authentic2Config' default_app_config = 'authentic2.app.Authentic2Config'
if django.VERSION < (2,): if django.VERSION < (2,):
from . import validators
from django.forms import fields from django.forms import fields
from . import validators
# query-string and form parameters used to query database charfield must be checked for NULL characters # query-string and form parameters used to query database charfield must be checked for NULL characters
# https://code.djangoproject.com/ticket/30064 # https://code.djangoproject.com/ticket/30064
if not getattr(fields.CharField, 'a2_workaround', False): if not getattr(fields.CharField, 'a2_workaround', False):

View File

@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib import admin from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils import six from django.utils import six
from django.utils.translation import ugettext_lazy as _
from . import models from . import models

View File

@ -22,10 +22,12 @@ class Authentic2RBACConfig(AppConfig):
verbose_name = 'Authentic2 RBAC' verbose_name = 'Authentic2 RBAC'
def ready(self): def ready(self):
from . import signal_handlers, models from django.db.models.signals import post_delete, post_migrate, post_save
from django.db.models.signals import post_save, post_migrate, post_delete
from authentic2.models import Service from authentic2.models import Service
from . import models, signal_handlers
# update rbac on save to contenttype, ou and roles # update rbac on save to contenttype, ou and roles
post_save.connect(signal_handlers.update_rbac_on_ou_post_save, sender=models.OrganizationalUnit) post_save.connect(signal_handlers.update_rbac_on_ou_post_save, sender=models.OrganizationalUnit)
post_delete.connect(signal_handlers.update_rbac_on_ou_post_delete, sender=models.OrganizationalUnit) post_delete.connect(signal_handlers.update_rbac_on_ou_post_delete, sender=models.OrganizationalUnit)

View File

@ -14,8 +14,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.db.models import NullBooleanField
from django import forms from django import forms
from django.db.models import NullBooleanField
class UniqueBooleanField(NullBooleanField): class UniqueBooleanField(NullBooleanField):

View File

@ -14,18 +14,17 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.utils import six
from django.utils.translation import ugettext_lazy as _, ugettext
from django.utils.text import slugify
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.utils import six
from django.utils.text import slugify
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from django_rbac.models import ADMIN_OP from django_rbac.models import ADMIN_OP
from django_rbac.utils import get_ou_model from django_rbac.utils import get_ou_model, get_permission_model, get_role_model
from django_rbac.utils import get_permission_model
from django_rbac.utils import get_role_model
from ..utils import get_fk_model from ..utils import get_fk_model
from . import utils, app_settings from . import app_settings, utils
from .models import MANAGE_MEMBERS_OP from .models import MANAGE_MEMBERS_OP

View File

@ -16,10 +16,11 @@
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django_rbac.models import ADMIN_OP
from django_rbac.managers import RoleManager as BaseRoleManager, AbstractBaseManager
from django_rbac.utils import get_operation
from django_rbac import utils as rbac_utils from django_rbac import utils as rbac_utils
from django_rbac.managers import AbstractBaseManager
from django_rbac.managers import RoleManager as BaseRoleManager
from django_rbac.models import ADMIN_OP
from django_rbac.utils import get_operation
class OrganizationalUnitManager(AbstractBaseManager): class OrganizationalUnitManager(AbstractBaseManager):

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import authentic2.utils
import authentic2.a2_rbac.fields
from django.conf import settings from django.conf import settings
from django.db import migrations, models
import authentic2.a2_rbac.fields
import authentic2.utils
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
from authentic2.migrations import CreatePartialIndexes from authentic2.migrations import CreatePartialIndexes

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
from authentic2.migrations import CreatePartialIndexes from authentic2.migrations import CreatePartialIndexes

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from collections import defaultdict from collections import defaultdict
from django.db import migrations from django.db import migrations

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
from authentic2.migrations import CreatePartialIndexes from authentic2.migrations import CreatePartialIndexes

View File

@ -3,6 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
import django_rbac.utils import django_rbac.utils

View File

@ -15,25 +15,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from collections import namedtuple from collections import namedtuple
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from django.utils import six
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from django.utils.text import slugify
from django.db import models from django.db import models
from django.contrib.contenttypes.models import ContentType from django.utils import six
from django.utils.text import slugify
from django_rbac.models import ( from django.utils.translation import pgettext_lazy
RoleAbstractBase, from django.utils.translation import ugettext_lazy as _
PermissionAbstractBase,
OrganizationalUnitAbstractBase,
RoleParentingAbstractBase,
VIEW_OP,
Operation,
)
from django_rbac import utils as rbac_utils
from authentic2.decorators import errorcollector from authentic2.decorators import errorcollector
from django_rbac import utils as rbac_utils
from django_rbac.models import (
VIEW_OP,
Operation,
OrganizationalUnitAbstractBase,
PermissionAbstractBase,
RoleAbstractBase,
RoleParentingAbstractBase,
)
try: try:
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
@ -43,7 +44,7 @@ except ImportError:
from authentic2.decorators import GlobalCache from authentic2.decorators import GlobalCache
from . import managers, fields, app_settings from . import app_settings, fields, managers
class OrganizationalUnit(OrganizationalUnitAbstractBase): class OrganizationalUnit(OrganizationalUnitAbstractBase):

View File

@ -14,15 +14,16 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.utils.translation import ugettext as _
from django.conf import settings
from django.apps import apps from django.apps import apps
from django.utils.translation import override from django.conf import settings
from django.db import DEFAULT_DB_ALIAS, router, transaction from django.db import DEFAULT_DB_ALIAS, router, transaction
from django.utils.translation import override
from django.utils.translation import ugettext as _
from django_rbac.managers import defer_update_transitive_closure
from django_rbac.utils import get_operation, get_ou_model, get_role_model
from ..utils import get_fk_model from ..utils import get_fk_model
from django_rbac.utils import get_ou_model, get_role_model, get_operation
from django_rbac.managers import defer_update_transitive_closure
def create_default_ou(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs): def create_default_ou(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs):
@ -52,7 +53,7 @@ def create_default_ou(app_config, verbosity=2, interactive=True, using=DEFAULT_D
def post_migrate_update_rbac(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs): def post_migrate_update_rbac(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs):
# be sure new objects names are localized using the default locale # be sure new objects names are localized using the default locale
from .management import update_ous_admin_roles, update_content_types_roles from .management import update_content_types_roles, update_ous_admin_roles
if not router.allow_migrate(using, get_role_model()): if not router.allow_migrate(using, get_role_model()):
return return
@ -85,12 +86,12 @@ def update_service_role_ou(sender, instance, created, raw, **kwargs):
def create_default_permissions(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs): def create_default_permissions(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs):
from .models import ( from .models import (
CHANGE_PASSWORD_OP,
RESET_PASSWORD_OP,
ACTIVATE_OP, ACTIVATE_OP,
CHANGE_EMAIL_OP, CHANGE_EMAIL_OP,
MANAGE_MEMBERS_OP, CHANGE_PASSWORD_OP,
MANAGE_AUTHORIZATIONS_OP, MANAGE_AUTHORIZATIONS_OP,
MANAGE_MEMBERS_OP,
RESET_PASSWORD_OP,
) )
if not router.allow_migrate(using, get_ou_model()): if not router.allow_migrate(using, get_ou_model()):

View File

@ -16,9 +16,9 @@
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django_rbac.models import VIEW_OP, SEARCH_OP
from django_rbac import utils as rbac_utils from django_rbac import utils as rbac_utils
from django_rbac.models import SEARCH_OP, VIEW_OP
from . import models from . import models

View File

@ -14,25 +14,25 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from copy import deepcopy
import pprint import pprint
from copy import deepcopy
from django.contrib import admin
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.views.decorators.cache import never_cache
from django.contrib.auth.admin import UserAdmin
from django.contrib.sessions.models import Session
from django.contrib.admin.utils import flatten_fieldsets
from django.db import transaction
from django import forms from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.utils import flatten_fieldsets
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.contrib.sessions.models import Session
from django.db import transaction
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import never_cache
from .nonce.models import Nonce from . import app_settings, attribute_kinds, decorators, models, utils
from . import models, app_settings, decorators, attribute_kinds, utils from .custom_user.models import DeletedUser, User
from .forms.profile import BaseUserForm, modelform_factory from .forms.profile import BaseUserForm, modelform_factory
from .custom_user.models import User, DeletedUser from .nonce.models import Nonce
def cleanup_action(modeladmin, request, queryset): def cleanup_action(modeladmin, request, queryset):

View File

@ -16,11 +16,9 @@
from django.db import transaction from django.db import transaction
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from rest_framework import status from rest_framework import status
from rest_framework.exceptions import APIException, ValidationError
from rest_framework.settings import api_settings from rest_framework.settings import api_settings
from rest_framework.exceptions import APIException
from rest_framework.exceptions import ValidationError
from rest_framework.utils import model_meta from rest_framework.utils import model_meta

View File

@ -14,62 +14,60 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from functools import partial
import logging import logging
import smtplib import smtplib
from functools import partial
from pytz.exceptions import AmbiguousTimeError
import django import django
from django.db import models import requests
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import identify_hasher from django.contrib.auth.hashers import identify_hasher
from django.core.exceptions import MultipleObjectsReturned from django.core.exceptions import MultipleObjectsReturned
from django.utils.translation import ugettext as _ from django.db import models
from django.utils.text import slugify
from django.utils.encoding import force_text
from django.utils.dateparse import parse_datetime
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.vary import vary_on_headers
from django.views.decorators.cache import cache_control
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.utils.dateparse import parse_datetime
from django_rbac.utils import get_ou_model, get_role_model from django.utils.encoding import force_text
import requests from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import cache_control
from django.views.decorators.vary import vary_on_headers
from django_filters.fields import IsoDateTimeField
from django_filters.filters import IsoDateTimeFilter
from django_filters.rest_framework import FilterSet
from django_filters.utils import handle_timezone
from pytz.exceptions import AmbiguousTimeError
from requests.exceptions import RequestException from requests.exceptions import RequestException
from rest_framework import VERSION as drf_version
from rest_framework import serializers, pagination, VERSION as drf_version from rest_framework import authentication, pagination, permissions, serializers, status
from rest_framework.authentication import SessionAuthentication
from rest_framework.exceptions import AuthenticationFailed, NotFound, PermissionDenied, ValidationError
from rest_framework.fields import CreateOnlyDefault
from rest_framework.filters import BaseFilterBackend
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from rest_framework.routers import SimpleRouter
from rest_framework.settings import api_settings
from rest_framework.validators import UniqueTogetherValidator from rest_framework.validators import UniqueTogetherValidator
from rest_framework.views import APIView from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet, ViewSet from rest_framework.viewsets import ModelViewSet, ViewSet
from rest_framework.routers import SimpleRouter
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from rest_framework import permissions, status, authentication
from rest_framework.exceptions import PermissionDenied, AuthenticationFailed, ValidationError, NotFound
from rest_framework.fields import CreateOnlyDefault
from authentic2.compat.drf import action from authentic2.compat.drf import action
from rest_framework.authentication import SessionAuthentication from django_rbac.utils import get_ou_model, get_role_model
from rest_framework.filters import BaseFilterBackend
from rest_framework.settings import api_settings
from django_filters.rest_framework import FilterSet from . import api_mixins, app_settings, attribute_kinds, decorators, hooks, utils
from django_filters.filters import IsoDateTimeFilter
from django_filters.fields import IsoDateTimeField
from django_filters.utils import handle_timezone
from .passwords import get_password_checker
from .custom_user.models import User
from . import utils, decorators, attribute_kinds, app_settings, hooks, api_mixins
from .models import Attribute, PasswordReset, Service
from .a2_rbac.utils import get_default_ou from .a2_rbac.utils import get_default_ou
from .custom_user.models import User
from .journal_event_types import UserLogin, UserRegistration from .journal_event_types import UserLogin, UserRegistration
from .models import Attribute, PasswordReset, Service
from .passwords import get_password_checker
from .utils.lookups import Unaccent from .utils.lookups import Unaccent
# Retro-compatibility with older Django versions # Retro-compatibility with older Django versions
if django.VERSION < (2,): if django.VERSION < (2,):
import rest_framework.fields import rest_framework.fields
from . import validators from . import validators
rest_framework.fields.ProhibitNullCharactersValidator = validators.ProhibitNullCharactersValidator rest_framework.fields.ProhibitNullCharactersValidator = validators.ProhibitNullCharactersValidator

View File

@ -15,10 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys import sys
import six
from django.utils.translation import ugettext_lazy as _ import six
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
class Setting(object): class Setting(object):

View File

@ -19,7 +19,7 @@ import json
from django.contrib import admin from django.contrib import admin
from django.utils.html import format_html from django.utils.html import format_html
from .models import EventType, Event from .models import Event, EventType
class EventTypeAdmin(admin.ModelAdmin): class EventTypeAdmin(admin.ModelAdmin):

View File

@ -16,11 +16,11 @@
from datetime import datetime from datetime import datetime
from django import forms
from django.http import QueryDict from django.http import QueryDict
from django.utils.formats import date_format from django.utils.formats import date_format
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django import forms
from . import models, search_engine from . import models, search_engine

View File

@ -1,10 +1,10 @@
# Generated by Django 2.2.15 on 2020-08-23 16:56 # Generated by Django 2.2.15 on 2020-08-23 16:56
from django.conf import settings
import django.contrib.postgres.fields import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from django.utils import timezone from django.utils import timezone

View File

@ -14,23 +14,23 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import re
from collections import defaultdict from collections import defaultdict
from contextlib import contextmanager from contextlib import contextmanager
from datetime import datetime, timedelta from datetime import datetime, timedelta
import logging
import re
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import ArrayField, JSONField from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields.jsonb import KeyTextTransform from django.contrib.postgres.fields.jsonb import KeyTextTransform
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.db import models from django.db import models
from django.db.models import QuerySet, Q, F, Value, Count from django.db.models import Count, F, Q, QuerySet, Value
from django.db.models.functions import Trunc from django.db.models.functions import Trunc
from django.utils.timezone import now, utc
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import utc, now
from authentic2.decorators import GlobalCache from authentic2.decorators import GlobalCache

View File

@ -14,8 +14,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from functools import reduce
import re import re
from functools import reduce
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.db.models import Q from django.db.models import Q

View File

@ -14,8 +14,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.db.models import Func, Subquery
from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.fields import ArrayField
from django.db.models import Func, Subquery
class ArraySubquery(Func): class ArraySubquery(Func):

View File

@ -14,9 +14,9 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from datetime import timedelta, date from datetime import date, timedelta
from django.db.models import Min, Max, DateField from django.db.models import DateField, Max, Min
def _json_value(value): def _json_value(value):

View File

@ -17,7 +17,7 @@
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from . import models, forms from . import forms, models
class JournalView(FormMixin, TemplateView): class JournalView(FormMixin, TemplateView):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -14,35 +14,32 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
import string
import datetime import datetime
import hashlib import hashlib
import os import os
import re
import string
from itertools import chain from itertools import chain
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.urls import reverse
from django.utils import six, formats
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
from django.utils import html
from django.core.files.storage import default_storage from django.core.files.storage import default_storage
from django.core.validators import RegexValidator
from django.db.models import query from django.db.models import query
from django.urls import reverse
from django.utils import formats, html, six
from django.utils.functional import keep_lazy from django.utils.functional import keep_lazy
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from gadjo.templatetags.gadjo import xstatic from gadjo.templatetags.gadjo import xstatic
from rest_framework import serializers from rest_framework import serializers
from rest_framework.fields import empty from rest_framework.fields import empty
from .decorators import to_iter
from .plugins import collect_from_plugins
from . import app_settings from . import app_settings
from .forms import widgets, fields from .decorators import to_iter
from .forms import fields, widgets
from .plugins import collect_from_plugins
@keep_lazy(six.text_type) @keep_lazy(six.text_type)

View File

@ -18,8 +18,8 @@ import logging
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from ..decorators import to_iter, to_list
from .. import app_settings, plugins, utils from .. import app_settings, plugins, utils
from ..decorators import to_iter, to_list
__ALL__ = ['get_attribute_names', 'get_attributes', 'get_service_attributes'] __ALL__ = ['get_attribute_names', 'get_attributes', 'get_service_attributes']

View File

@ -20,9 +20,8 @@ from django.utils.translation import ugettext_lazy as _
from django_rbac.utils import get_role_model from django_rbac.utils import get_role_model
from ...models import Attribute, AttributeValue
from ...decorators import to_list from ...decorators import to_list
from ...models import Attribute, AttributeValue
@to_list @to_list

View File

@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import six import six
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from ...decorators import to_list from ...decorators import to_list

View File

@ -14,10 +14,10 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from ...decorators import to_list
from authentic2.backends.ldap_backend import LDAPBackend, LDAPUser from authentic2.backends.ldap_backend import LDAPBackend, LDAPUser
from ...decorators import to_list
@to_list @to_list
def get_instances(ctx): def get_instances(ctx):

View File

@ -16,10 +16,10 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from ...models import Service
from authentic2.a2_rbac.models import Role from authentic2.a2_rbac.models import Role
from ...decorators import to_list from ...decorators import to_list
from ...models import Service
@to_list @to_list

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core import validators from django.core import validators
from django.db import models, migrations from django.db import migrations, models
from django.utils import timezone from django.utils import timezone

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.validators import django.core.validators
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
import django.contrib.auth.models import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -23,10 +23,10 @@ try:
except ImportError: except ImportError:
CallableTrue = True CallableTrue = True
from authentic2_idp_oidc.models import OIDCClient
from rest_framework.exceptions import AuthenticationFailed
from rest_framework.authentication import BasicAuthentication from rest_framework.authentication import BasicAuthentication
from rest_framework.exceptions import AuthenticationFailed
from authentic2_idp_oidc.models import OIDCClient
class OIDCUser(object): class OIDCUser(object):

View File

@ -18,15 +18,18 @@ import logging
from django.db.models import Count from django.db.models import Count
from django.shortcuts import render from django.shortcuts import render
from django.utils.translation import ugettext as _, ugettext_lazy from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from authentic2.a2_rbac.models import OrganizationalUnit as OU, Role from authentic2.a2_rbac.models import OrganizationalUnit as OU
from authentic2.a2_rbac.models import Role
from authentic2.custom_user.models import User from authentic2.custom_user.models import User
from . import views, app_settings, utils
from .utils.views import csrf_token_check from . import app_settings, utils, views
from .utils.service import get_service_from_request
from .forms import authentication as authentication_forms from .forms import authentication as authentication_forms
from .utils.evaluate import evaluate_condition from .utils.evaluate import evaluate_condition
from .utils.service import get_service_from_request
from .utils.views import csrf_token_check
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from authentic2 import app_settings from authentic2 import app_settings

View File

@ -20,11 +20,10 @@ try:
import ldap import ldap
import ldap.modlist import ldap.modlist
import ldap.sasl import ldap.sasl
from ldap.filter import filter_format from ldap.controls import DecodeControlTuples, SimplePagedResultsControl, ppolicy
from ldap.dn import escape_dn_chars from ldap.dn import escape_dn_chars
from ldap.filter import filter_format
from ldap.ldapobject import ReconnectLDAPObject as NativeLDAPObject from ldap.ldapobject import ReconnectLDAPObject as NativeLDAPObject
from ldap.controls import SimplePagedResultsControl, DecodeControlTuples
from ldap.controls import ppolicy
from pyasn1.codec.der import decoder from pyasn1.codec.der import decoder
PYTHON_LDAP3 = [int(x) for x in ldap.__version__.split('.')] >= [3] PYTHON_LDAP3 = [int(x) for x in ldap.__version__.split('.')] >= [3]
@ -32,41 +31,40 @@ try:
except ImportError: except ImportError:
ldap = None ldap = None
PYTHON_LDAP3 = None PYTHON_LDAP3 = None
import logging
import random
import base64 import base64
import os
import json import json
import logging
import os
import random
import time import time
# code originaly copied from by now merely inspired by
# http://www.amherst.k12.oh.us/django-ldap.html
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.utils.encoding import force_bytes, force_text from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured
from django.utils import six from django.utils import six
from django.utils.encoding import force_bytes, force_text
from django.utils.six.moves.urllib import parse as urlparse from django.utils.six.moves.urllib import parse as urlparse
from django.utils.translation import ugettext as _, ngettext from django.utils.translation import ngettext
from django.utils.translation import ugettext as _
from authentic2 import app_settings, crypto
from authentic2.a2_rbac.models import Role from authentic2.a2_rbac.models import Role
from authentic2.compat_lasso import lasso
from authentic2 import crypto, app_settings
from authentic2.models import UserExternalId
from authentic2.middleware import StoreRequestMiddleware
from authentic2.user_login_failure import user_login_failure, user_login_success
from django_rbac.utils import get_ou_model
from authentic2.a2_rbac.utils import get_default_ou from authentic2.a2_rbac.utils import get_default_ou
from authentic2.ldap_utils import FilterFormatter
from authentic2.utils import to_list
from authentic2.backends import is_user_authenticable from authentic2.backends import is_user_authenticable
from authentic2.compat_lasso import lasso
from authentic2.ldap_utils import FilterFormatter
from authentic2.middleware import StoreRequestMiddleware
from authentic2.models import UserExternalId
from authentic2.user_login_failure import user_login_failure, user_login_success
from authentic2.utils import to_list
from django_rbac.utils import get_ou_model
# code originaly copied from by now merely inspired by
# http://www.amherst.k12.oh.us/django-ldap.html
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -16,15 +16,15 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.backends import ModelBackend
from django.db import models
from django.utils import six from django.utils import six
from .. import app_settings
from authentic2.user_login_failure import user_login_success, user_login_failure
from authentic2.backends import get_user_queryset from authentic2.backends import get_user_queryset
from authentic2.user_login_failure import user_login_failure, user_login_success
from .. import app_settings
def upn(username, realm): def upn(username, realm):

View File

@ -14,14 +14,13 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt
from django.utils.decorators import method_decorator
from django.forms import Form
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.conf import settings from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.forms import Form
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie
from . import utils, hooks from . import hooks, utils
from .utils.views import csrf_token_check from .utils.views import csrf_token_check

View File

@ -18,7 +18,7 @@
try: try:
from rest_framework.decorators import action from rest_framework.decorators import action
except ImportError: except ImportError:
from rest_framework.decorators import list_route, detail_route from rest_framework.decorators import detail_route, list_route
def action(**kwargs): def action(**kwargs):
kwargs.pop('name', None) kwargs.pop('name', None)

View File

@ -14,8 +14,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
import inspect import inspect
from datetime import datetime
from django.conf import settings from django.conf import settings
from django.utils import six from django.utils import six

View File

@ -14,10 +14,10 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from pkg_resources import get_distribution
from django.conf import settings from django.conf import settings
from pkg_resources import get_distribution
from . import utils, app_settings, constants from . import app_settings, constants, utils
from .models import Service from .models import Service

View File

@ -15,13 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import itertools import itertools
from .decorators import SessionCache
from django.apps import apps from django.apps import apps
from django.conf import settings from django.conf import settings
from django.utils.six.moves.urllib import parse as urlparse from django.utils.six.moves.urllib import parse as urlparse
from . import plugins, app_settings from . import app_settings, plugins
from .decorators import SessionCache
def make_origin(url): def make_origin(url):

View File

@ -19,12 +19,10 @@ import hashlib
import hmac import hmac
import struct import struct
from Cryptodome.Cipher import AES
from Cryptodome.Protocol.KDF import PBKDF2
from Cryptodome.Hash import SHA256
from Cryptodome.Hash import HMAC
from Cryptodome import Random from Cryptodome import Random
from Cryptodome.Cipher import AES
from Cryptodome.Hash import HMAC, SHA256
from Cryptodome.Protocol.KDF import PBKDF2
from django.utils.crypto import constant_time_compare from django.utils.crypto import constant_time_compare
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.six import text_type from django.utils.six import text_type

View File

@ -19,9 +19,8 @@ from __future__ import unicode_literals
import csv import csv
import io import io
from chardet.universaldetector import UniversalDetector
import attr import attr
from chardet.universaldetector import UniversalDetector
from django import forms from django import forms
from django.contrib.auth.hashers import identify_hasher from django.contrib.auth.hashers import identify_hasher
from django.core.exceptions import FieldDoesNotExist, ValidationError from django.core.exceptions import FieldDoesNotExist, ValidationError
@ -29,18 +28,16 @@ from django.core.validators import RegexValidator
from django.db import IntegrityError, models from django.db import IntegrityError, models
from django.db.transaction import atomic from django.db.transaction import atomic
from django.utils import six from django.utils import six
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes, force_text
from django.utils.encoding import force_text
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django_rbac.utils import get_role_model
from authentic2 import app_settings from authentic2 import app_settings
from authentic2.a2_rbac.utils import get_default_ou from authentic2.a2_rbac.utils import get_default_ou
from authentic2.custom_user.models import User from authentic2.custom_user.models import User
from authentic2.forms.profile import modelform_factory, BaseUserForm from authentic2.forms.profile import BaseUserForm, modelform_factory
from authentic2.models import Attribute, AttributeValue, UserExternalId from authentic2.models import Attribute, AttributeValue, UserExternalId
from authentic2.utils import send_password_reset_mail from authentic2.utils import send_password_reset_mail
from django_rbac.utils import get_role_model
Role = get_role_model() Role = get_role_model()

View File

@ -14,8 +14,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.db import DEFAULT_DB_ALIAS, router
from django.apps import AppConfig from django.apps import AppConfig
from django.db import DEFAULT_DB_ALIAS, router
class CustomUserConfig(AppConfig): class CustomUserConfig(AppConfig):
@ -30,13 +30,14 @@ class CustomUserConfig(AppConfig):
def create_first_name_last_name_attributes( def create_first_name_last_name_attributes(
self, app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs self, app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, **kwargs
): ):
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from django.conf import settings from django.conf import settings
from authentic2.attribute_kinds import get_kind
from authentic2.models import Attribute, AttributeValue
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from authentic2.attribute_kinds import get_kind
from authentic2.models import Attribute, AttributeValue
if not router.allow_migrate(using, Attribute): if not router.allow_migrate(using, Attribute):
return return

View File

@ -14,16 +14,16 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals, print_function from __future__ import print_function, unicode_literals
import getpass import getpass
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.core.exceptions import MultipleObjectsReturned
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS from django.db import DEFAULT_DB_ALIAS
from django.utils.encoding import force_str
from django.db.models.query import Q from django.db.models.query import Q
from django.core.exceptions import MultipleObjectsReturned from django.utils.encoding import force_str
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals, print_function from __future__ import print_function, unicode_literals
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View File

@ -17,21 +17,20 @@
import unicodedata import unicodedata
import uuid import uuid
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.search import TrigramDistance
from django.core.exceptions import ValidationError
from django.db import models, connection
from django.db.models import F, Value, FloatField, Subquery, OuterRef, Q
from django.db.models.functions import Lower, Coalesce
from django.utils import timezone
from django.contrib.auth.models import BaseUserManager from django.contrib.auth.models import BaseUserManager
from django.contrib.postgres.search import SearchQuery from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.search import SearchQuery, TrigramDistance
from django.core.exceptions import ValidationError
from django.db import connection, models
from django.db.models import F, FloatField, OuterRef, Q, Subquery, Value
from django.db.models.functions import Coalesce, Lower
from django.utils import timezone
from authentic2 import app_settings from authentic2 import app_settings
from authentic2.models import AttributeValue
from authentic2.utils.lookups import Unaccent, ImmutableConcat
from authentic2.utils.date import parse_date
from authentic2.attribute_kinds import clean_number from authentic2.attribute_kinds import clean_number
from authentic2.models import AttributeValue
from authentic2.utils.date import parse_date
from authentic2.utils.lookups import ImmutableConcat, Unaccent
class UserQuerySet(models.QuerySet): class UserQuerySet(models.QuerySet):

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone import django.utils.timezone
from django.db import migrations, models
import authentic2.utils import authentic2.utils
import authentic2.validators import authentic2.validators

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf import settings from django.conf import settings
from django.db import models, migrations from django.db import migrations, models
class ThirdPartyAlterField(migrations.AlterField): class ThirdPartyAlterField(migrations.AlterField):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
def noop(apps, schema_editor): def noop(apps, schema_editor):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
def noop(apps, schema_editor): def noop(apps, schema_editor):

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models
import datetime import datetime
from django.db import migrations, models
from django.utils.timezone import utc from django.utils.timezone import utc

View File

@ -2,9 +2,8 @@
# Generated by Django 1.11.29 on 2020-11-02 21:52 # Generated by Django 1.11.29 on 2020-11-02 21:52
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.db import migrations
def noop(apps, schema_editor): def noop(apps, schema_editor):

View File

@ -1,6 +1,7 @@
# Generated by Django 2.2.19 on 2021-02-26 10:02 # Generated by Django 2.2.19 on 2021-02-26 10:02
from django.db import migrations from django.db import migrations
from authentic2 import app_settings from authentic2 import app_settings

View File

@ -22,28 +22,27 @@ import datetime
import os import os
import random import random
from django.db import models, transaction from django.core.exceptions import MultipleObjectsReturned, ValidationError
from django.utils import timezone
from django.core.mail import send_mail from django.core.mail import send_mail
from django.utils import six from django.db import models, transaction
from django.utils import six, timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError, MultipleObjectsReturned
try: try:
from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.fields import GenericRelation
except ImportError: except ImportError:
from django.contrib.contenttypes.generic import GenericRelation from django.contrib.contenttypes.generic import GenericRelation
from django.contrib.auth.models import AbstractBaseUser from django.contrib.auth.models import AbstractBaseUser
from django.contrib.postgres.fields import JSONField from django.contrib.postgres.fields import JSONField
from authentic2 import app_settings, utils
from authentic2.decorators import RequestCache, errorcollector
from authentic2.models import Attribute, AttributeValue, Service, UserExternalId
from authentic2.validators import email_validator
from django_rbac.models import PermissionMixin from django_rbac.models import PermissionMixin
from django_rbac.utils import get_role_parenting_model from django_rbac.utils import get_role_parenting_model
from authentic2 import utils, app_settings
from authentic2.decorators import errorcollector, RequestCache
from authentic2.models import Service, AttributeValue, Attribute, UserExternalId
from authentic2.validators import email_validator
from .managers import UserManager, UserQuerySet from .managers import UserManager, UserQuerySet

View File

@ -18,17 +18,16 @@ from __future__ import unicode_literals
from functools import wraps from functools import wraps
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.utils.text import format_lazy from django.utils.text import format_lazy
from django.utils.translation import ugettext_lazy as _
from django_rbac.models import Operation
from django_rbac.utils import get_ou_model, get_role_model, get_role_parenting_model, get_permission_model
from authentic2.decorators import errorcollector
from authentic2.a2_rbac.models import RoleAttribute from authentic2.a2_rbac.models import RoleAttribute
from authentic2.decorators import errorcollector
from authentic2.utils.lazy import lazy_join from authentic2.utils.lazy import lazy_join
from django_rbac.models import Operation
from django_rbac.utils import get_ou_model, get_permission_model, get_role_model, get_role_parenting_model
def update_model(obj, d): def update_model(obj, d):

View File

@ -17,21 +17,21 @@
import base64 import base64
import pickle import pickle
import re import re
from json import dumps as json_dumps
from contextlib import contextmanager
import time import time
from contextlib import contextmanager
from functools import wraps from functools import wraps
from json import dumps as json_dumps
from django.views.debug import technical_404_response
from django.http import Http404, HttpResponseForbidden, HttpResponse, HttpResponseBadRequest
from django.core.cache import cache as django_cache from django.core.cache import cache as django_cache
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
from django.utils import six from django.utils import six
from django.views.debug import technical_404_response
from . import app_settings, middleware from . import app_settings, middleware
# XXX: import to_list for retrocompaibility # XXX: import to_list for retrocompaibility
from .utils import to_list, to_iter # noqa: F401 from .utils import to_iter, to_list # noqa: F401
class CacheUnusable(RuntimeError): class CacheUnusable(RuntimeError):

View File

@ -23,15 +23,14 @@
import logging import logging
from xml.dom.minidom import parseString from xml.dom.minidom import parseString
from django.http import HttpResponseRedirect
from django.conf.urls import url from django.conf.urls import url
from django.utils.translation import ugettext as _ from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.http import urlquote from django.utils.http import urlquote
from django.utils.six.moves.urllib import parse as urlparse from django.utils.six.moves.urllib import parse as urlparse
from django.urls import reverse from django.utils.translation import ugettext as _
from authentic2 import settings from authentic2 import settings
from authentic2.saml.common import error_page as base_error_page from authentic2.saml.common import error_page as base_error_page

View File

@ -14,12 +14,12 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
import logging
import hashlib import hashlib
import logging
import time
from django.utils import six
from django.core.cache import cache from django.core.cache import cache
from django.utils import six
class ExponentialRetryTimeout(object): class ExponentialRetryTimeout(object):

View File

@ -19,17 +19,18 @@ import math
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.forms.widgets import Media
from django.utils.translation import ugettext_lazy as _, ugettext
from django.contrib.auth import forms as auth_forms from django.contrib.auth import forms as auth_forms
from django.forms.widgets import Media
from django.utils import html from django.utils import html
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from authentic2.forms.fields import PasswordField from authentic2.forms.fields import PasswordField
from authentic2.utils.lazy import lazy_label from authentic2.utils.lazy import lazy_label
from ..a2_rbac.models import OrganizationalUnit as OU
from .. import app_settings, utils from .. import app_settings, utils
from ..a2_rbac.models import OrganizationalUnit as OU
from ..exponential_retry_timeout import ExponentialRetryTimeout from ..exponential_retry_timeout import ExponentialRetryTimeout

View File

@ -14,26 +14,25 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import warnings
import io import io
import warnings
from django.forms import CharField, FileField, ValidationError, EmailField
from django.forms.fields import FILE_INPUT_CONTRADICTION
from django.utils.translation import ugettext_lazy as _
from django.core.files import File
from authentic2 import app_settings
from authentic2.passwords import password_help_text, validate_password
from authentic2.forms.widgets import (
PasswordInput,
NewPasswordInput,
CheckPasswordInput,
ProfileImageInput,
EmailInput,
)
from authentic2.validators import email_validator
import PIL.Image import PIL.Image
from django.core.files import File
from django.forms import CharField, EmailField, FileField, ValidationError
from django.forms.fields import FILE_INPUT_CONTRADICTION
from django.utils.translation import ugettext_lazy as _
from authentic2 import app_settings
from authentic2.forms.widgets import (
CheckPasswordInput,
EmailInput,
NewPasswordInput,
PasswordInput,
ProfileImageInput,
)
from authentic2.passwords import password_help_text, validate_password
from authentic2.validators import email_validator
class PasswordField(CharField): class PasswordField(CharField):

View File

@ -16,7 +16,7 @@
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.forms import Form, CheckboxInput, BooleanField from django.forms import BooleanField, CheckboxInput, Form
from django.utils.html import mark_safe from django.utils.html import mark_safe
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _

View File

@ -17,20 +17,19 @@
import logging import logging
from collections import OrderedDict from collections import OrderedDict
from django import forms
from django.contrib.auth import forms as auth_forms from django.contrib.auth import forms as auth_forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db.models import Q from django.db.models import Q
from django.forms import Form from django.forms import Form
from django import forms
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from .. import models, hooks, app_settings, utils from .. import app_settings, hooks, models, utils
from ..backends import get_user_queryset from ..backends import get_user_queryset
from .fields import PasswordField, NewPasswordField, CheckPasswordField, ValidatedEmailField from .fields import CheckPasswordField, NewPasswordField, PasswordField, ValidatedEmailField
from .utils import NextUrlFormMixin from .utils import NextUrlFormMixin
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -16,15 +16,17 @@
from collections import OrderedDict from collections import OrderedDict
from django.forms.models import modelform_factory as dj_modelform_factory
from django import forms from django import forms
from django.utils.translation import ugettext_lazy as _, ugettext from django.forms.models import modelform_factory as dj_modelform_factory
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from authentic2 import app_settings, models from authentic2 import app_settings, models
from authentic2.custom_user.models import User from authentic2.custom_user.models import User
from .utils import NextUrlFormMixin
from .mixins import LockedFieldFormMixin
from .fields import ValidatedEmailField from .fields import ValidatedEmailField
from .mixins import LockedFieldFormMixin
from .utils import NextUrlFormMixin
class DeleteAccountForm(forms.Form): class DeleteAccountForm(forms.Form):

View File

@ -17,19 +17,19 @@
import re import re
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.models import BaseUserManager, Group
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator from django.core.validators import RegexValidator
from django.utils.translation import ugettext_lazy as _, ugettext from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import BaseUserManager, Group
from authentic2.forms.fields import NewPasswordField, CheckPasswordField
from authentic2.a2_rbac.models import OrganizationalUnit from authentic2.a2_rbac.models import OrganizationalUnit
from authentic2.forms.fields import CheckPasswordField, NewPasswordField
from .. import app_settings, models from .. import app_settings, models
from . import profile as profile_forms from . import profile as profile_forms
from .honeypot import HoneypotForm
from .fields import ValidatedEmailField from .fields import ValidatedEmailField
from .honeypot import HoneypotForm
User = get_user_model() User = get_user_model()

View File

@ -23,21 +23,21 @@
# License: BSD # License: BSD
# Initial Author: Alfredo Saglimbeni # Initial Author: Alfredo Saglimbeni
import datetime
import json import json
import re import re
import uuid import uuid
import datetime
import django import django
from django import forms from django import forms
from django.forms.widgets import DateTimeInput, DateInput, TimeInput, ClearableFileInput from django.forms.widgets import ClearableFileInput, DateInput, DateTimeInput
from django.forms.widgets import EmailInput as BaseEmailInput
from django.forms.widgets import PasswordInput as BasePasswordInput from django.forms.widgets import PasswordInput as BasePasswordInput
from django.forms.widgets import TextInput, EmailInput as BaseEmailInput from django.forms.widgets import TextInput, TimeInput
from django.utils.formats import get_language, get_format from django.utils.encoding import force_text
from django.utils.formats import get_format, get_language
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import force_text
from gadjo.templatetags.gadjo import xstatic from gadjo.templatetags.gadjo import xstatic
from authentic2 import app_settings from authentic2 import app_settings

View File

@ -14,17 +14,17 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import base64
import hashlib import hashlib
import math import math
import base64
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from collections import OrderedDict from collections import OrderedDict
from django.contrib.auth import hashers from django.contrib.auth import hashers
from django.utils.crypto import constant_time_compare
from django.utils.translation import ugettext_noop as _
from django.utils.encoding import force_bytes, force_text
from django.contrib.auth.hashers import make_password from django.contrib.auth.hashers import make_password
from django.utils.crypto import constant_time_compare
from django.utils.encoding import force_bytes, force_text
from django.utils.translation import ugettext_noop as _
class Drupal7PasswordHasher(hashers.BasePasswordHasher): class Drupal7PasswordHasher(hashers.BasePasswordHasher):

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

Some files were not shown because too many files have changed in this diff Show More