diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ba9dcf5..5ded2eb6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,8 +49,7 @@ before_script: - echo "CREATE DATABASE ${MYSQL_QOS_DATABASE}" | mysql -u${MYSQL_QOS_USER} -p${MYSQL_QOS_PASSWORD} -h ${MYSQL_QOS_HOST} - source .install/scripts/install_openldap.sh # - source .install/scripts/install_latex.sh - - pip3 install --upgrade pip - - pip3 install -qUr requirements.txt + - pip3 install --break-system-packages -qUr requirements.txt - rm -f -- ${ROOTDIR}myresel/settings_local.py - export MYSQL_USER=root - source .install/scripts/configure.sh diff --git a/.install/etc/ldap/slapd.conf b/.install/etc/ldap/slapd.conf index 3bb7e094..cd99a431 100644 --- a/.install/etc/ldap/slapd.conf +++ b/.install/etc/ldap/slapd.conf @@ -50,8 +50,7 @@ loglevel 65535 # Where the dynamically loaded modules are stored modulepath /usr/lib/ldap -moduleload back_bdb -moduleload back_hdb +moduleload back_mdb #moduleload back_ldap moduleload back_monitor moduleload syncprov @@ -71,7 +70,7 @@ tool-threads 1 # Specific Backend Directives for bdb: # Backend specific directives apply to this backend until another # 'backend' directive occurs -backend bdb +backend mdb ####################################################### ## Configuration relative a la gestion des accesslogs @@ -96,7 +95,7 @@ backend bdb # Specific Directives for database #1, of type bdb: # Database specific directives apply to this databasse until another # 'database' directive occurs -database bdb +database mdb # The base of your directory in database #1 suffix "dc=maisel,dc=enst-bretagne,dc=fr" @@ -185,9 +184,6 @@ syncprov-sessionlog 100 # These access lines apply to database #1 only mode 0600 -cachesize 100000 -#dbcachesize 125829120 # seulement en LDBM - checkpoint 1024 10 # Ensure read access to the base for things like @@ -208,7 +204,7 @@ checkpoint 1024 10 #database # The backend type, bdb, is the default standard -database bdb +database mdb # The base of your directory in database #2 suffix "dc=resel,dc=enst-bretagne,dc=fr" @@ -275,9 +271,6 @@ syncprov-sessionlog 100 mode 0600 -cachesize 100000 -#dbcachesize 5242880 seulement en LDBM - checkpoint 1024 10 # Activation du monitoring diff --git a/.install/scripts/install_essentials.sh b/.install/scripts/install_essentials.sh index 8526c741..d693740e 100644 --- a/.install/scripts/install_essentials.sh +++ b/.install/scripts/install_essentials.sh @@ -7,5 +7,5 @@ else apt-get -qq upgrade fi -apt-get -qq install build-essential python3-software-properties python3 python3-dev python3-pip vim libssl-dev libmariadbclient-dev gcc +apt-get -qq install build-essential python3-software-properties python3 python3-dev python3-pip vim libssl-dev default-libmysqlclient-dev gcc pkg-config #easy_install3 -U pip # Solve debian bug diff --git a/Dockerfile b/Dockerfile index 0d57feec..75b2609c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:10 +FROM debian:12 ARG LDAPPASSWD ARG DEBIAN_FRONTEND=noninteractive @@ -15,8 +15,7 @@ RUN chmod +x install_essentials.sh && ./install_essentials.sh RUN apt -qq update && apt -qq upgrade -y COPY requirements.txt requirements.txt -RUN pip3 install --upgrade pip -RUN pip3 install -qr requirements.txt +RUN pip3 install --break-system-packages -qr requirements.txt # LDAP RUN apt -qq install expect ldap-utils libldap2-dev libsasl2-dev libssl-dev ldapvi -y diff --git a/campus/forms.py b/campus/forms.py index 7d3100e7..2a906ae1 100644 --- a/campus/forms.py +++ b/campus/forms.py @@ -8,7 +8,7 @@ from django.forms import ModelForm, CharField, TextInput, Form, Textarea, ChoiceField,\ EmailField, IntegerField, Select, CheckboxInput, SelectMultiple from django.forms.models import ModelMultipleChoiceField -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.db.models import Q from ldap3.core.exceptions import LDAPException diff --git a/campus/models/rooms_models.py b/campus/models/rooms_models.py index f8ce589c..5eb6a6f2 100644 --- a/campus/models/rooms_models.py +++ b/campus/models/rooms_models.py @@ -1,6 +1,6 @@ from dateutil.relativedelta import relativedelta from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist diff --git a/campus/templates/base_campus.html b/campus/templates/base_campus.html index 6658a52a..ae2981a6 100644 --- a/campus/templates/base_campus.html +++ b/campus/templates/base_campus.html @@ -1,4 +1,4 @@ -{% load staticfiles %} +{% load static %} {% load i18n %} diff --git a/campus/templates/campus/ae-admin/add-admin.html b/campus/templates/campus/ae-admin/add-admin.html index a441d749..1caba402 100644 --- a/campus/templates/campus/ae-admin/add-admin.html +++ b/campus/templates/campus/ae-admin/add-admin.html @@ -1,5 +1,5 @@ {% load i18n %} -{% load staticfiles %} +{% load static %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/devices/templates/devices/list_devices.html b/devices/templates/devices/list_devices.html index 284da6fa..8082e84d 100644 --- a/devices/templates/devices/list_devices.html +++ b/devices/templates/devices/list_devices.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block titre %}{% trans "Mes machines" %}{% endblock %} diff --git a/devices/views.py b/devices/views.py index 7dae9e29..da14e05b 100644 --- a/devices/views.py +++ b/devices/views.py @@ -10,7 +10,7 @@ from django.http import HttpResponseRedirect from django.shortcuts import render from django.utils.decorators import method_decorator -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import FormView from django.views.generic import View, ListView diff --git a/fonctions/decorators.py b/fonctions/decorators.py index 045f9d3c..9ef812af 100644 --- a/fonctions/decorators.py +++ b/fonctions/decorators.py @@ -5,8 +5,7 @@ from django.contrib import messages from django.urls import reverse from django.http import HttpResponseRedirect -from django.utils.decorators import available_attrs -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ logger = logging.getLogger("default") @@ -19,7 +18,7 @@ def resel_required(function=None, redirect_to='home'): """ def _dec(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _view(request, *args, **kwargs): if request.network_data['is_resel']: return view_func(request, *args, **kwargs) @@ -44,7 +43,7 @@ def maisel_manager_required(function=None, redirect_to='home'): """ def _dec(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _view(request, *args, **kwargs): try: if not request.ldap_user: @@ -70,7 +69,7 @@ def not_maisel(function=None, redirect_to='home'): """Vérifie que l'user n'est pas de la Maisel""" def _dec(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _view(request, *args, **kwargs): try: if not request.ldap_user: @@ -102,7 +101,7 @@ def need_to_pay(function=None, redirect_to='home'): """ def _dec(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _view(request, *args, **kwargs): try: if not request.ldap_user: @@ -133,7 +132,7 @@ def able_to_pay(function=None, redirect_to='home'): """ def _dec(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _view(request, *args, **kwargs): subnet = request.network_data['subnet'] if subnet in ['REGN', 'EXPN']: @@ -161,7 +160,7 @@ def ae_required(function, redirect_to='campus:rooms:calendar'): """ def _dec(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _view(request, *args, **kwargs): ae = False for period in request.ldap_user.dates_membre: @@ -184,7 +183,7 @@ def ae_admin_required(function, redirect_to='campus:home'): Check if the user has ae_admin attribute """ def _dec(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _view(request, *args, **kwargs): if (not request.user.is_authenticated): return HttpResponseRedirect( diff --git a/fonctions/generic.py b/fonctions/generic.py index 1bbc198b..0c14ae43 100644 --- a/fonctions/generic.py +++ b/fonctions/generic.py @@ -5,6 +5,7 @@ import os from base64 import decodebytes, encodebytes from datetime import datetime, time, date +from passlib.hash import nthash def current_year(): @@ -50,7 +51,7 @@ def compare_passwd(passwd, hsh): def hash_to_ntpass(password): """ Fourni un hash du mdp pour correspondre avec le loggin over Wi-Fi """ - return str(binascii.hexlify(hashlib.new('md4', password.encode('utf-16le')).digest()).upper()).split('\'')[1] + return nthash.hash(password).upper() def sizeof_fmt(num, suffix='o'): diff --git a/gestion_personnes/forms.py b/gestion_personnes/forms.py index 01933f88..1fbfac51 100644 --- a/gestion_personnes/forms.py +++ b/gestion_personnes/forms.py @@ -7,7 +7,7 @@ from django.urls import reverse from django.core.validators import MaxLengthValidator, MinLengthValidator, EmailValidator from django.utils.text import slugify -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from phonenumber_field.formfields import PhoneNumberField from fonctions.generic import current_year diff --git a/gestion_personnes/templates/gestion_personnes/cgu.html b/gestion_personnes/templates/gestion_personnes/cgu.html index 3738e655..9926f1a3 100644 --- a/gestion_personnes/templates/gestion_personnes/cgu.html +++ b/gestion_personnes/templates/gestion_personnes/cgu.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load staticfiles %} +{% load static %} {% load i18n %} {% block titre %}{% trans "Inscription - CGU" %}{% endblock %} diff --git a/gestion_personnes/templates/gestion_personnes/finalize_signup.html b/gestion_personnes/templates/gestion_personnes/finalize_signup.html index 6ad0baf5..26da3889 100644 --- a/gestion_personnes/templates/gestion_personnes/finalize_signup.html +++ b/gestion_personnes/templates/gestion_personnes/finalize_signup.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load staticfiles %} +{% load static %} {% load i18n %} {% block titre %}{% trans "Inscription - Finalisation" %}{% endblock %} diff --git a/gestion_personnes/templates/gestion_personnes/inscription.html b/gestion_personnes/templates/gestion_personnes/inscription.html index 71905d2e..306393c8 100644 --- a/gestion_personnes/templates/gestion_personnes/inscription.html +++ b/gestion_personnes/templates/gestion_personnes/inscription.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load staticfiles %} +{% load static %} {% load i18n %} {% block titre %}{% trans "Inscription" %}{% endblock %} diff --git a/gestion_personnes/templates/gestion_personnes/personal_info.html b/gestion_personnes/templates/gestion_personnes/personal_info.html index 567cbf27..b023706d 100644 --- a/gestion_personnes/templates/gestion_personnes/personal_info.html +++ b/gestion_personnes/templates/gestion_personnes/personal_info.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load staticfiles %} +{% load static %} {% load i18n %} {% block titre %}{% trans "Informations personnelles" %}{% endblock %} diff --git a/gestion_personnes/templates/gestion_personnes/settings.html b/gestion_personnes/templates/gestion_personnes/settings.html index 616ae252..954230fc 100644 --- a/gestion_personnes/templates/gestion_personnes/settings.html +++ b/gestion_personnes/templates/gestion_personnes/settings.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load staticfiles %} +{% load static %} {% load i18n %} {% block titre %}{% trans "Paramètres de compte" %}{% endblock %} @@ -25,4 +25,4 @@

{% trans "Paramètres" %}

{% endblock %} {% block javascript %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/gestion_personnes/views.py b/gestion_personnes/views.py index 7ddb6f40..781cefae 100644 --- a/gestion_personnes/views.py +++ b/gestion_personnes/views.py @@ -14,7 +14,7 @@ from django.http import HttpResponseForbidden, HttpResponseRedirect from django.shortcuts import render from django.utils.decorators import method_decorator -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.generic import FormView, View from fonctions import ldap diff --git a/maisel/forms.py b/maisel/forms.py index de8a6c45..fd13b325 100644 --- a/maisel/forms.py +++ b/maisel/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class ApproveEmployeeForm(forms.Form): employee = forms.CharField() diff --git a/maisel/templates/maisel/list_employees.html b/maisel/templates/maisel/list_employees.html index 8c8b2d4e..ab55aacf 100644 --- a/maisel/templates/maisel/list_employees.html +++ b/maisel/templates/maisel/list_employees.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block titre %}{% trans "Mon équipe" %}{% endblock %} diff --git a/maisel/views.py b/maisel/views.py index 02aec447..6cc66e49 100644 --- a/maisel/views.py +++ b/maisel/views.py @@ -3,7 +3,7 @@ from django.views.generic.edit import FormMixin from django.utils.decorators import method_decorator from django.contrib import messages -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from fonctions.decorators import maisel_manager_required from fonctions.generic import next_august_fifteenth from gestion_personnes.models import LdapUser diff --git a/myresel/settings.py b/myresel/settings.py index ce440e5a..a7b2e922 100644 --- a/myresel/settings.py +++ b/myresel/settings.py @@ -11,7 +11,7 @@ from ipaddress import ip_network from django.test.runner import DiscoverRunner -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from myresel.settings_local import * @@ -121,6 +121,7 @@ 'toolbar': 'full', 'height': 600, 'width': 1000, + 'versionCheck': False, }, } @@ -225,6 +226,8 @@ }, } +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators @@ -338,30 +341,20 @@ 'formatter': 'verbose', 'include_html': True, }, - 'logstash': { - 'level': 'DEBUG', - 'class': 'logstash.LogstashHandler', - 'host': 'orion', - 'port': 5959, # Default value: 5959 - 'version': 1, - 'message_type': 'django', - 'fqdn': False, # Fully qualified domain name. Default value: false. - 'tags': None, # list of tags. Default: None. - }, }, 'loggers': { 'default': { - 'handlers': ['file', 'logstash'], + 'handlers': ['file'], 'level': 'DEBUG', 'propagate': True, }, 'django': { - 'handlers': ['file', 'logstash'], + 'handlers': ['file'], 'level': 'DEBUG', 'propagate': True, }, "rq.worker": { - "handlers": ['file', 'logstash'], + "handlers": ['file'], "level": "DEBUG" }, diff --git a/myresel/urls.py b/myresel/urls.py index 9d1dc89e..319ac8fe 100644 --- a/myresel/urls.py +++ b/myresel/urls.py @@ -1,18 +1,5 @@ -"""myresel URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/1.9/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.conf.urls import url, include - 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) -""" +"""myresel URL Configuration """ + from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin diff --git a/pages/forms.py b/pages/forms.py index 752cb3a0..a63d53e1 100644 --- a/pages/forms.py +++ b/pages/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class ContactForm(forms.Form): diff --git a/pages/templates/pages/become_admin.html b/pages/templates/pages/become_admin.html index 19434db8..79b5e6f1 100644 --- a/pages/templates/pages/become_admin.html +++ b/pages/templates/pages/become_admin.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load staticfiles %} +{% load static %} {% load i18n %} {% block titre %}{% trans "Devenez adminitrateur ResEl" %}{% endblock %} diff --git a/pages/templates/pages/eggdrop.html b/pages/templates/pages/eggdrop.html index 3bb1d3af..9fb2f5b7 100644 --- a/pages/templates/pages/eggdrop.html +++ b/pages/templates/pages/eggdrop.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block css %} diff --git a/pages/templates/pages/faq.html b/pages/templates/pages/faq.html index 34cfb369..50a63db3 100644 --- a/pages/templates/pages/faq.html +++ b/pages/templates/pages/faq.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block css %} diff --git a/pages/templates/pages/home/home.html b/pages/templates/pages/home/home.html index be0d326e..c8fcde04 100644 --- a/pages/templates/pages/home/home.html +++ b/pages/templates/pages/home/home.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block titre %}{% trans "Accueil" %}{% endblock %} diff --git a/pages/templates/pages/home/home_ext.html b/pages/templates/pages/home/home_ext.html index 4a153f9e..ccdaec91 100644 --- a/pages/templates/pages/home/home_ext.html +++ b/pages/templates/pages/home/home_ext.html @@ -1,6 +1,6 @@ {% extends 'pages/home/home.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block myresel %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/pages/templates/pages/home/home_int.html b/pages/templates/pages/home/home_int.html index 6ee7aa58..f0c31d09 100644 --- a/pages/templates/pages/home/home_int.html +++ b/pages/templates/pages/home/home_int.html @@ -1,6 +1,6 @@ {% extends 'pages/home/home.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block myresel %} {#
#} @@ -18,4 +18,4 @@ {#
#} {# #} {# #} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/pages/templates/pages/home/home_logged.html b/pages/templates/pages/home/home_logged.html index 9e908f33..04453289 100644 --- a/pages/templates/pages/home/home_logged.html +++ b/pages/templates/pages/home/home_logged.html @@ -1,6 +1,6 @@ {% extends 'pages/home/home.html' %} {% load i18n %} -{% load staticfiles %} +{% load static %} {% block myresel %}