Skip to content

Commit

Permalink
Merge branch 'july-2023' into 'master'
Browse files Browse the repository at this point in the history
July 2023 megacommit

See merge request resel/applications-utilisateurs/myresel!272
  • Loading branch information
bensmrs committed Jul 19, 2023
2 parents 169fce2 + f0de286 commit 5201a9a
Show file tree
Hide file tree
Showing 105 changed files with 2,276 additions and 1,146 deletions.
16 changes: 8 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

variables:
IMAGE: $CI_REGISTRY_IMAGE
DOCKER_DRIVER: overlay
DOCKER_DRIVER: overlay2

MYSQL_HOST: mysql-mysql-server
MYSQL_USER: resel
Expand Down Expand Up @@ -39,10 +39,10 @@ stages:

Build docker image:
stage: docker_build
image: $DOCKER_IMAGE
services:
- name: $RUNNER_IMAGE
alias: docker
image: docker:stable
- name: $RUNNER_IMAGE
alias: docker
before_script: &before_script
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
Expand All @@ -57,10 +57,10 @@ Build docker image:

Push docker image:
stage: docker_push
image: $DOCKER_IMAGE
services:
- name: $RUNNER_IMAGE
alias: docker
image: docker:stable
- name: $RUNNER_IMAGE
alias: docker
before_script: *before_script
script:
- docker pull $IMAGE:$CI_COMMIT_SHA
Expand Down Expand Up @@ -117,7 +117,7 @@ django test suite:
python linting:
stage: test
script:
- pylint --rcfile=.pylintrc --django-settings-module=myresel.settings campus fonctions gestion_personnes ldapback myresel pages tresorerie wiki || exit $((35 & $?))
- pylint --rcfile=.pylintrc --django-settings-module=myresel.settings campus fonctions gestion_personnes ldapback maisel myresel pages tresorerie wiki || exit $((35 & $?))
allow_failure: false
tags:
- admin
Expand Down
87 changes: 84 additions & 3 deletions .install/etc/ldap/schema/resel-14628.schema
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
# 23 : Attributs AE

# Benjamin Somers - 2020
# 24 : Attributs maiselEmployee
# 30 : Attributs partages
# 31 : Attributs CAS
# 50 : Attributs reselZone
# 51 : Attributs reselBuilding
# 52 : Attributs reselPool
# 53 : Attributs reselDevice
# 54 : Attributs reselVLAN
# 55 : Attributs reselParentSw - TEMPORAIRE jusqu'à refacto switch/topo
# 56 : Attributs reselLease
# 57 : Attributs reselTenant - 2022
# 60 : Attributs IPv4*
# 61 : Attributs reselWebsite - OC de transition jusqu'à refacto clubs
# 62 : Attributs websiteCategory
Expand All @@ -53,6 +57,7 @@
# mibValue : valeur possible pour un mib donn?

# guestPerson : personne residant a la MaisEl temporairement mais ne disposant pas de compte ecole
# maiselEmployee : employe Maisel/MDE

#attributs enstb MUST
######################
Expand Down Expand Up @@ -824,6 +829,45 @@ attributetype ( 1.3.6.1.4.1.14628.3.8 NAME 'ntPassword'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )


# Attributs pour maiselEmployee
###############################

attributetype ( 1.3.6.1.4.1.14628.24.1 NAME 'maiselEmployeeType'
DESC 'Type d employe Maisel MDE'
EQUALITY caseIgnoreMatch
ORDERING caseIgnoreOrderingMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )


# Attributs partages
####################

attributetype ( 1.3.6.1.4.1.14628.30.1 NAME 'label'
DESC 'Label'
EQUALITY caseIgnoreMatch
ORDERING caseIgnoreOrderingMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

attributetype ( 1.3.6.1.4.1.14628.30.2 NAME 'memberDN'
DESC 'Member DN'
SUP distinguishedName )


# Attributs CAS
###############

attributetype ( 1.3.6.1.4.1.14628.31.1 NAME 'mfa'
DESC 'MFA method'
EQUALITY caseIgnoreMatch
ORDERING caseIgnoreOrderingMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )


# Attributs pour reselZone
######################################

Expand Down Expand Up @@ -974,6 +1018,34 @@ attributetype ( 1.3.6.1.4.1.14628.56.2 NAME 'leaseID'
SINGLE-VALUE )


# Attributs pour reselZone
######################################

attributetype ( 1.3.6.1.4.1.14628.57.1 NAME 'tenantID'
DESC 'Identifiant du tenant'
EQUALITY numericStringMatch
ORDERING numericStringOrderingMatch
SUBSTR numericStringSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.14628.57.2 NAME 'tenantName'
DESC 'Nom du tenant'
EQUALITY caseIgnoreMatch
ORDERING caseIgnoreOrderingMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.14628.57.3 NAME 'tenantCode'
DESC 'Nom abrege du tenant'
EQUALITY caseIgnoreMatch
ORDERING caseIgnoreOrderingMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )


# Attributs pour IPv4Branch
######################################

Expand Down Expand Up @@ -1063,7 +1135,7 @@ attributeType ( 1.3.6.1.4.1.14628.61.3 NAME 'siteCategory'
objectclass ( 1.3.6.1.4.1.14628.1.0 NAME 'genericPerson' STRUCTURAL
DESC 'Personne générique'
MUST ( uid $ firstName $ lastName $ userPassword )
MAY ( imAddresses $ lmPassword $ ntPassword $ displayName $ postalAddress $ telephoneNumber ) )
MAY ( imAddresses $ lmPassword $ ntPassword $ displayName $ postalAddress $ telephoneNumber $ label $ mfa ) )

##Personne ayant un compte sun
objectclass ( 1.3.6.1.4.1.14628.1.1 NAME 'enstbPerson' AUXILIARY
Expand Down Expand Up @@ -1094,8 +1166,8 @@ objectclass ( 1.3.6.1.4.1.14628.1.23 NAME 'aePerson' AUXILIARY
##personne ayant une machine au resel
objectclass ( 1.3.6.1.4.1.14628.1.5 NAME 'reselPerson' AUXILIARY
DESC 'Personne disposant d une machine'
MUST ( uid $ firstName $ lastName $ dateInscr )
MAY ( cotiz $ endInternet $ days $ startFirstMonth $ lastUserDate $ userPassword $ coupure $ shapePropre $ shapeSale $ ban $ v6Prefix $ campus $ freeformBirthDate $ birthPlace $ birthCountry ) )
MUST ( uid $ firstName $ lastName $ dateInscr $ mail )
MAY ( cotiz $ endInternet $ days $ startFirstMonth $ lastUserDate $ userPassword $ coupure $ shapePropre $ shapeSale $ ban $ v6Prefix $ campus $ freeformBirthDate $ birthPlace $ birthCountry $ mobile ) )

##Personne ayant un mail au resel
## theoriquement ces attributs sont faits pour sendmail
Expand Down Expand Up @@ -1213,6 +1285,10 @@ objectclass ( 1.3.6.1.4.1.14628.1.22 NAME 'reselSTB' STRUCTURAL
MUST ( cn $ machine $ stbBrand )
MAY ( stbType ) )

objectclass ( 1.3.6.1.4.1.14628.24.0 NAME 'maiselEmployee' AUXILIARY
DESC 'Employe Maisel MDE'
MUST ( maiselEmployeeType ) )

objectclass ( 1.3.6.1.4.1.14628.50.0 NAME 'reselZone' STRUCTURAL
DESC 'Zone du ResEl'
MUST ( zoneID $ zoneCode $ vlanOffset )
Expand Down Expand Up @@ -1246,6 +1322,11 @@ objectclass ( 1.3.6.1.4.1.14628.56.0 NAME 'reselLease' STRUCTURAL
DESC 'DHCP lease'
MUST ( leaseID $ macAddress $ ipHostNumber $ leaseExpiry ) )

objectclass ( 1.3.6.1.4.1.14628.57.0 NAME 'reselTenant' STRUCTURAL
DESC 'Tenant du ResEl'
MUST ( tenantID $ tenantCode )
MAY ( tenantName ) )

objectclass ( 1.3.6.1.4.1.14628.60.0 NAME 'IPv4Branch' STRUCTURAL
DESC 'Branche IPv4'
MUST ( bits )
Expand Down
4 changes: 2 additions & 2 deletions campus/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def list_clubs(self, room):
"""
List all the clubs allowed to access the Room
"""

html = '<p>'
for club in room.get_clubs():
html += '%s<br>' % club
Expand All @@ -52,7 +52,7 @@ def list_clubs(self, room):

class RoomAdministratorAdmin(admin.ModelAdmin):
"""
Admin configuration for RoomAdmin model
Admin configuration for RoomAdmin model
"""
list_display = ('user', 'list_rooms')

Expand Down
22 changes: 11 additions & 11 deletions campus/forms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import datetime
import re

from django import forms
from django.conf import settings
from django.core.validators import MaxLengthValidator
Expand All @@ -8,17 +11,14 @@
from django.utils.translation import ugettext_lazy as _
from django.db.models import Q

from ldap3.core.exceptions import LDAPException

from campus.models import RoomBooking, Room, RoomAdmin, StudentOrganisation, Mail, Association, ListeCampagne
from gestion_personnes.models import LdapUser
from gestion_personnes.forms import PersonnalInfoForm


from ldap3.core.exceptions import LDAPException
from fonctions import ldap

import datetime
import re

class RoomBookingForm(ModelForm):
class Meta:
model = RoomBooking
Expand Down Expand Up @@ -159,7 +159,7 @@ def clean_mailing_list(self):
email=self.cleaned_data["mailing_list"]
if not (re.match(r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+', email) or email == ""):
raise ValidationError(message=_("L'adresse email semble être invalide"), code="Bad MAIL")
return(email)
return email

def clean_clubs(self):
clubs = ""
Expand All @@ -172,7 +172,7 @@ def clean_clubs(self):
raise ValidationError(message=_("Le club suivant n'existe pas: %s"%(club,)), code="CLUB DOES NOT EXIST")
if not re.match(r'^[a-z0-9-]+', club):
raise ValidationError(message=_("Le club suivant n'a pas un nom valide: %s"%(club,)), code="BAD CLUB")
return(";".join(clubs))
return ";".join(clubs)


class DisabledCharField(CharField):
Expand Down Expand Up @@ -347,11 +347,11 @@ def create_club(self):
class ClubEditionForm(ClubManagementForm):

def clean_cn(self):
return(self.cleaned_data['cn'].lower())
return self.cleaned_data['cn'].lower()

def clean_logo(self):
logo = self.cleaned_data['logo']
return(logo)
return logo
def edit_club(self, pk):
club = StudentOrganisation.get(cn=pk)

Expand Down Expand Up @@ -472,8 +472,8 @@ def _sort_results(self, unsorted):
# Delete duplicates
results = []
for r in unsorted:
if r.uid not in [u.uid for u in results]:
results.append(r)
if r.uid not in [u.uid for u in results]:
results.append(r)
for result in results:
result.promo = self.int_safe(result.promo)
results.sort(key=lambda u: u.promo, reverse=True)
Expand Down
2 changes: 1 addition & 1 deletion campus/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from campus.models import StudentOrganisation, RoomAdmin, Room

class RoomAdminMiddleware(object):
class RoomAdminMiddleware:
"""
Check if user is a RoomAdmin, and updates his credentials accordingly
"""
Expand Down
20 changes: 20 additions & 0 deletions campus/migrations/0004_auto_20210721_0824.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 2.2.24 on 2021-07-21 06:24

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('campus', '0003_add_booking_name'),
]

operations = [
migrations.AlterField(
model_name='roomadmin',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL, verbose_name='utilisateur'),
),
]
2 changes: 1 addition & 1 deletion campus/models/clubs_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

import ldapback
from ldapback.models.fields import LdapCharField, LdapListField, LdapCharField, LdapBooleanField
from ldapback.models.fields import LdapListField, LdapCharField, LdapBooleanField
from myresel.settings import LDAP_OU_CLUBS


Expand Down
6 changes: 0 additions & 6 deletions campus/models/mails_models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver

import django_rq
from gestion_personnes.models import LdapUser
from gestion_personnes.models import LdapGroup
from campus import async_tasks

class Mail(models.Model):
sender = models.CharField(
Expand Down
1 change: 0 additions & 1 deletion campus/models/rooms_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from django.core.exceptions import ObjectDoesNotExist

import django_rq
from datetime import timedelta

from gestion_personnes.models import LdapUser
import campus.async_tasks as async_tasks
Expand Down
4 changes: 2 additions & 2 deletions campus/templates/base_campus.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<title>Campus.resel.fr | {% block title %}{% endblock %}</title>

{# CSS #}
<link href="{% static 'boostrap/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'font-awesome/css/font-awesome.min.css' %}" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/campus/base.css' %}">
{% block css %}{% endblock %}
Expand Down Expand Up @@ -212,7 +212,7 @@

{# javascript #}
<script type="text/javascript" src="{% static 'jquery/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'boostrap/js/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'bootstrap/js/bootstrap.min.js' %}"></script>
<script>
var k = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65],
n = 0;
Expand Down
Loading

0 comments on commit 5201a9a

Please sign in to comment.